From professional translators, enterprises, web pages and freely available translation repositories.
example 1. serialize() example
蛁: in php 3, object properties will be serialized, but methods are lost. php 4 removes that limitation and restores both properties and methods. please see the serializing objects section of classes and objects for more information.
using serialize to save an object will save all variables in an object.
serialize() returns a string containing a byte-stream representation of any value that can be stored in php. unserialize() can use this string to recreate the original variable values. using serialize to save an object will save all variables in an object. the functions in an object will not be saved, only the name of the class.
if you want to serialize non-ascii characters you have to set the appropriate locale before doing so (see setlocale()).
ע: if you want to serialize non-ascii characters you have to set the appropriate locale before doing so (see setlocale()).
drupal will serialize the key alert_text and the value associated with that form item after submission and cut a record in the variable table using autologout for the name field and the serialized key/value pairs for the value field.
在提交表单之后,drupal 将键 alert_text 和与这个表单元素相关联的值串在一起,并使用 autologout 作为名称字段,串在一起的键 / 值对作为值字段,从而在变量表中设置一个记录。
?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();}}?
?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();}}?