cvs: phpdoc-zh /reference/var/functions serialize.xml
| From: | Krazy Nio | Date: | Thu, 12 Jun 2003 13:19:40 +0000 |
| Subject: | cvs: phpdoc-zh /reference/var/functions serialize.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1501@lists.php.net to get a copy of this message | ||
nio Thu Jun 12 09:19:40 2003 EDT
Added files:
/phpdoc-zh/reference/var/functions serialize.xml
Log:
Add file
Index: phpdoc-zh/reference/var/functions/serialize.xml
+++ phpdoc-zh/reference/var/functions/serialize.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: nio $ -->
<!-- EN-Revision: 1.5 Maintainer: nio Status: ready -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.28 -->
<refentry id="function.serialize">
<refnamediv>
<refname>serialize</refname>
<refpurpose>
²úÉúÒ»¸ö¿É´æ´¢µÄÖµµÄ±íʾ
</refpurpose>
</refnamediv>
<refsect1>
<title>ÃèÊö</title>
<methodsynopsis>
<type>string</type><methodname>serialize</methodname>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<simpara>
<function>serialize</function>
·µ»Ø×Ö·û´®£¬´Ë×Ö·û´®°üº¬Á˱íʾ
<parameter>value</parameter>
µÄ×Ö½ÚÁ÷£¬¿ÉÒÔ´æ´¢ÓÚÈκεط½¡£
</simpara>
<simpara>
ÕâÓÐÀûÓÚ´æ´¢»ò´«µÝ PHP
µÄÖµ£¬Í¬Ê±²»¶ªÊ§ÆäÀàÐͺͽṹ¡£
</simpara>
<simpara>
ÏëÒª½«ÒÑÐòÁл¯µÄ×Ö·û´®±ä»Ø PHP µÄÖµ£¬¿ÉʹÓÃ
<function>unserialize</function>¡£<function>serialize</function>
¿É´¦Àí³ýÁË <type>resource</type>
Ö®ÍâµÄÈκÎÀàÐÍ¡£ÉõÖÁ¿ÉÒÔ <function>serialize</function>
ÄÇЩ°üº¬ÁËÖ¸ÏòÆä×ÔÉíÒýÓõÄÊý×é¡£ÄãÕý
<function>serialize</function>
µÄÊý×飯¶ÔÏóÖеÄÒýÓÃÒ²½«±»´æ´¢¡£
</simpara>
<simpara>
µ±ÐòÁл¯¶ÔÏóʱ£¬PHP
½«ÊÔͼÔÚÐòÁж¯×÷֮ǰµ÷ÓøöÔÏóµÄ³ÉÔ±º¯Êý
<function>__sleep</function>¡£ÕâÑù¾ÍÔÊÐí¶ÔÏóÔÚ±»ÐòÁл¯Ö®Ç°×öÈκÎÇå³ý²Ù×÷¡£ÀàËÆµÄ£¬µ±Ê¹ÓÃ
<function>unserialize</function> »Ö¸´¶ÔÏóʱ£¬ ½«µ÷ÓÃ
<function>__wakeup</function> ³ÉÔ±º¯Êý¡£
</simpara>
<!-- TODO
in 4.0.4pl1 this didn't work properly, however, there
been some fixes. I don't know whether this all
works correctly now, and if so, whether it is since 405
or 406
<note>
<simpara>
This didn't work correctly until 4.0.?
</simpara>
</note>
</simpara>
-->
<note>
<para>
ÔÚ PHP 3
ÖУ¬¶ÔÏóÊôÐÔ½«±»ÐòÁл¯£¬µ«ÊÇ·½·¨Ôò»á¶ªÊ§¡£PHP 4
´òÆÆÁË´ËÏÞÖÆ£¬¿ÉÒÔͬʱ´æ´¢ÊôÐԺͷ½·¨¡£Çë²Î¼û<link
linkend="language.oop">ÀàÓë¶ÔÏó</link>ÖеÄ<link
linkend="language.oop.serialization">ÐòÁл¯¶ÔÏó</link>²¿·Ö»ñÈ¡¸ü¶àÐÅÏ¢¡£
</para>
</note>
<para>
<example>
<title><function>serialize</function> ʾÀý</title>
<programlisting role="php">
<![CDATA[
// $session_data Êǰüº¬Á˵±Ç°Óû§ session ÐÅÏ¢µÄ¶àάÊý×é¡£
// ÎÒÃÇʹÓà serialize() ÔÚÇëÇó½áÊøÖ®Ç°½«Æä´æ´¢µ½Êý¾Ý¿âÖС£
$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn,
"UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $PHP_AUTH_USER);
if (!odbc_execute ($stmt, &$sqldata)) {
$stmt = odbc_prepare($conn,
"INSERT INTO sessions (id, data) VALUES(?, ?)");
if (!odbc_execute($stmt, &$sqldata)) {
/* ³ö´í */
}
}
]]>
</programlisting>
</example>
</para>
<para>
²Î¼û£º<function>unserialize</function>¡£
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->