From professional translators, enterprises, web pages and freely available translation repositories.
example 2. unserialize() example
דוגמה 2. unserialize() example
Last Update: 2011-10-24
Usage Frequency: 1
Quality:
if you want to be able to unserialize this on page2.php, recreating $a of class a, the definition of class a must be present in page2.php.
על מנת להשתמש ב unserialize() על אובייקט, המחלקה של אותו אובייקט צריכה להיות ממומשת. ולפיכך, אם יש את האובייקט $a של המחלקה a שבדף page1.php ובוצע serialize עליה, תתקבל מחרוזת שתייחס למחלקה a ואשר תכיל את כל הערכים של המשתנים הקיימים $a. כשיש צורך להשתמש ב unserialize שב page2.php, יצירה מחדש של הובייקט $a של המחלקה a, ההגדקה של המחלקה a חייבת להיות מיוצגת ב - page2.php. זה יכול להעשות לדוגמא על ידי איכסון של הגדרת המחלקה a בתוך קובץ מוכלל והכללת קובץ זה גם ב page1.php וגם ב page2.php.
Last Update: 2011-10-24
Usage Frequency: 1
Quality:
?php / / here, we use unserialize() to load session data to the / / $session_data array from the string selected from a database. / / this example complements the one described with serialize(). $conn = odbc_connect ("webdb", "php", "chicken"); $stmt = odbc_prepare ($conn, "select data from sessions where id = ?"); $sqldata = array ($php_auth_user); if (!odbc_execute ($stmt, $sqldata) _bar_ _bar_ !odbc_fetch_into ($stmt, $tmp)) {/ / if the execute or fetch fails, initialize to empty array $session_data = array();} else {/ / we should now have the serialized data in $tmp[0]. $session_data = unserialize ($tmp[0]); if (!is_array ($session_data)) {/ / something went wrong, initialize to empty array $session_data = array();}}?
/ / here, we use unserialize() to load session data to the / / $session_data array from the string selected from a database. / / this example complements the one described with serialize(). $conn = odbc_connect ("webdb", "php", "chicken"); $stmt = odbc_prepare ($conn, "select data from sessions where id = ?"); $sqldata = array ($php_auth_user); if (!odbc_execute ($stmt, $sqldata) _bar_ _bar_ !odbc_fetch_into ($stmt, $tmp)) {/ / if the execute or fetch fails, initialize to empty array $session_data = array();} else {/ / we should now have the serialized data in $tmp[0]. $session_data = unserialize ($tmp[0]); if (!is_array ($session_data)) {/ / something went wrong, initialize to empty array $session_data = array();}}
Last Update: 2011-10-24
Usage Frequency: 1
Quality:
Warning: Contains invisible HTML formatting