Using the serialize () function and unserialize () function, the usage of these two functions is really out of the box. one is for serialization storage, and the other is for serialization recovery, which is very convenient today, I am doing
PHP (beginning with PHP3.05) provides a set of serialization and deserialization functions for saving objects: serialize and unserialize. However, in the PHP manual, the description of these two functions is limited to how to use them, but the
Today, in doing something about the ping service, because do not want to put the ping service address into the database, so bad, ping service is not an inefficient thing, and then put into the database, not only to reduce the efficiency of the
Serialize () converts an array to an object
Unserialize () restores the converted Array
$arrayarray();$array['key''website';$array['value']='www.chhua.com';$a = serialize($array); print_r($a);$b = unserialize($a);print_r($b);
The results were as
Simple Introductionserialization, which is the conversion format, converts a string, or an object, or a list, into a stream form, a stream of text (XML, TXT, Dat ...). ) or a binary stream, the conversion back is deserialization.
XML and
As we know, in PHP, we can use Session_encode () and Session_decode () to encode/decode the session data, ried these
functionality, you'll see the They is not going as you think. So here, I find these, functionality, which, and you'll help.
/*
give me a chestnut :Here, we use Unserialize () to load session data from the $session _data array from the database.This example is a supplement to the example that describes serialize ().$conn = Odbc_connect ("WebDB", "PHP", "chicken");$stmt =
PHP has a good way to format strings and convert an array or object, that is, serialization processing.
There are two ways to serialize variables.
The following example uses the Serialize () and Unserialize () functions:
A complex Array$myvar =
Format: var data = $ ("form"). Serialize ();Function: Serializes the contents of the form into a single string.This way, when Ajax submits the form data, it is not necessary to enumerate each parameter. Simply set the data parameter to $ ("form").
In PHP, there is a good way to format a string and transform an array or object, that is, serialization processing.There are two ways to serialize variables.
The following example uses the Serialize () and Unserialize () functions:
A
How to serialize functions in JavaScript? What is the function serialization function? This article will introduce the function serialization in SpiderMonkey. If you need it, you can refer to the function in Javascript, which can be easily
Original form value acquisition method (manual ):
$. Ajax ({type: "POST", url: "ajax. php ", data:" Name = extract star & position = IT technology ", success: function (msg) {alert (msg) ;}, error: function (error) {alert (error );}});
JQ serialize
The Code comes from the jQuery formValidator Form Verification plug-in (added in 4.0.2) and applies to all platforms.
You can see from the jQuery source code that the serialize method is encoded by encodeURIComponent, so the most stupid method to
C#. NET how to Not serialize fields, properties
When we use public properties and public fields, we are able to serialize them smoothly.View Sourceprint?01.[Serializable]02.public class MyClass03.{04. public int ID;05. 06. public string
Php uses json instead of serialize. if you need it, refer to it. note that the returned object is json_decode, and the json_decode (quot; string quot;, ture... php uses json instead of serialize. if you need it, refer to it.
Note that json_decode
It took an early morning (more than four hours) to sum up the lesson: the text content in the textarea tag cannot be obtained through the serialize () method, textareaserialize1. Let's take a look at the complete code, that is, the final answer! 2.
Is the returned string stored in memory after the serialize () function is used? If you have any questions, please answer them! ------ Solution ------------------ you must use a variable to carry the data; otherwise, $ sserialize (array (1, 2, 3) is
Knowledge about serialize Al Object serialization in Python
This article mainly introduces the serialization of marshal objects in Python. It is related to serialization in Python advanced learning. For more information, see
Sometimes, you need to
In daily development, communication between different platforms is common, such as. NET and PHP. You may be using WebService or simply need to process some data transmitted by the other party. If some standard data formats such as XML and JSON are
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.