javascript - How does php process the values ​​of the serialized form and convert them into the form corresponding to the key value?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-05 11:07:30
0
1
490

Rookie for advice

Use $.ajax to submit,

$.ajax({
               type: "POST",
               url: 'getData.php',
               async: false,
               data: $('#guestbook').serialize(),
               error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                        alert(XMLHttpRequest.readyState);
                        alert(textStatus);
                    },
               success: function(data){
                alert(data);
               }
            })
            

The serialized value obtained in the background is in the form of name1=value1&name2=value2&name3=value3 ...

$data = file_get_contents("php://input");
$str = urldecode($data);    

How to convert the obtained data into an array or json, and the key value corresponds

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
迷茫

parse_str

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!