当前位置: 代码迷 >> PHP >> php怎么解析jquery serialize 提交后的数据
  详细解决方案

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

热度:719   发布时间:2013-06-25 23:45:42.0
php如何解析jquery serialize 提交后的数据
本帖最后由 Jasmine_xiaocao 于 2013-05-14 18:33:40 编辑
客户端通过jquery  serialize 提交表单数据


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


在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
                )

        )

)


  相关解决方案