Home > Article > Backend Development > How to Decode jQuery Serialized Data with PHP?
When utilizing jQuery's serialize() function to transmit form data to a PHP page, the serialized data needs to be unserialized in PHP to extract the individual form values. Here's how you can do that:
Assume that your server receives a string resembling this:
"param1=someVal&param2=someOtherVal"
In PHP, you can use the following code to parse the string and store the values in an array:
$params = array(); parse_str($_GET, $params);
With this code, $params will become an array with key-value pairs representing the form data, allowing you to access and manipulate the data as needed.
For more comprehensive information, refer to:
http://www.php.net/manual/en/function.parse-str.php
The above is the detailed content of How to Decode jQuery Serialized Data with PHP?. For more information, please follow other related articles on the PHP Chinese website!