从POST请求中我得到和混合结构JSON和字段Array;处理多种类型的元素;我已经执行和 var_dump 来获取通行证$_POST并得到这个:
array(2) {
["json_data"]=>
string(677) "[{"firstname":""},{"lastname":""},{"email":""},{"countryCode":""},{"phone":""},{"i_signup_password":""},{"i_signup_password_rep":""},{"email":""},{"i_signin_password":""},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"},{"form":"d-sys-login"},{"process":"e-signin"}]",
["other_data"]=>
string(11) "Other_Data"
}
在 PHP 服务器端,我正在执行一个函数,将其减少$_POST为这个数组:
array(10) {
["firstname"]=>
string(0) ""
["lastname"]=>
string(0) ""
["email"]=>
string(0) ""
["countryCode"]=>
string(0) ""
["phone"]=>
string(0) ""
["i_signup_password"]=>
string(0) ""
["i_signup_password_rep"]=>
string(0) ""
["i_signin_password"]=>
string(0) ""
["form"]=>
string(11) "d-sys-login"
["process"]=>
string(8) "e-signin"
}
主要问题是最后一个成员数组丢失:
["other_data"]=> string(11) "other_data"
我怎样才能防止丢失数据?
这个脚本可以更简单吗?
慕斯王