php怎麼解析jquery serialize 提交後的資料

來源:互聯網
上載者:User
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
)

)

)


分享到:
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.