Heim >Backend-Entwicklung >PHP-Tutorial >php怎么解析jquery serialize 提交后的数据

php怎么解析jquery serialize 提交后的数据

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:25:231000Durchsuche

php如何解析jquery serialize 提交后的数据

本帖最后由 Jasmine_xiaocao 于 2013-05-14 18:33:40 编辑 客户端通过jquery  serialize 提交表单数据

<br />$("#submit_survey").click(function(){<br />    	 $.post(SITE_URL+'activity/survey/savesurvey', {data:$('#survey_form').serialize()}, function(response){<br />            if (response.error_code) {<br />                infotips(response.msg, $('.submit_tips'));<br />            } else {<br />                infotips('保存成功', $('.submit_tips'), 'right');<br />            } <br />        }, 'json'); <br />    	return false;<br />    });<br />


在php端post到的数据为:
title=%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%9C%A8%E8%BF%99%E9%87%8C%E5%88%9B%E5%BB%BA%E6%82%A8%E7%9A%84%E9%97%AE%E7%AD%94%E9%A2%98%E7%9B%AE%EF%BC%8C%E5%90%8C%E6%97%B6%E5%AF%B9%E9%97%AE%E7%AD%94%E6%B4%BB%E5%8A%A8%E5%8A%A0%E4%BB%A5%E8%AF%B4%E6%98%8E&cover_image=&file_name=&file_partpath=&description=&isgender=0&isarea=0&isage=0&question%5B1%5D=ghk&option%5B1%5D%5B0%5D=hgkhk&option%5B1%5D%5B1%5D=hkhj&option%5B1%5D%5B2%5D=khgkhk&option%5B1%5D%5B3%5D=&question%5B2%5D=hgkh&option%5B2%5D%5B0%5D=hkhjk&option%5B2%5D%5B1%5D=hjkhjl&option%5B2%5D%5B2%5D=

如何替换为正确的格式:
Array
(
    [title] => dsgd
    [cover_image] => hdsgdsg
    [file_name] => 219_20130514170542.jpg
    [file_partpath] => 
    [description] => 
    [isgender] => 0
    [isarea] => 0
    [isage] => 0
    [question] => Array
        (
            [1] => dgdg
        )

    [option] => Array
        (
            [1] => Array
                (
                    [0] => aa
                    [1] => bb
                    [2] => cc
                )

        )

)


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn