uni-app 前端數(shù)據(jù)
前端提交數(shù)據(jù)格式:
header: {
'Content-Type' :'application/x-www-form-urlencoded',
'charset': 'utf-8'
},
url: 'https://www.**********',
data: _self.spsl,
method: "POST",
1.使用 spsl:JSON.stringify(_self.spsl), 格式化后
spsl:"[{"spdm":"11001","spsl":1},{"spdm":"11002","spsl":1}]"
2.php后臺接收 :
先保存字符數(shù)據(jù),使用json_decode 轉(zhuǎn)換為數(shù)組寇荧。
$sp1=$_POST['spsl'];
$sp=array();
$sp=json_decode($sp1,true);