json 除去转义字符以及查看json错误
$param=stripslashes($_POST['param']);
try{
//$param包含了文档指定的信息,...这里保存您的快递信息,$param的格式与订阅时指定的格式一致
$arr = json_decode($param, true);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo ' - No errors';
break;
case JSON_ERROR_DEPTH:
echo ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
echo ' - Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
echo ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
echo ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
echo ' - Unknown error';
break;
}
// $sql = "INSERT INTO ecs_order_action (order_id, action_user, order_status, shipping_status, pay_status, action_place, action_note, logistics_type, logistics_code, log_time) " .
// "values('905', 'zoushenhua', '1', '1','1', '1','note','1','yuantong',now())";
// write_log('kuaidi100', $arr);
print_r($arr);
echo '{"result":true, "returnCode":"200", "message":"成功"}';
// $db->query($sql);
//要返回成功(格式与订阅时指定的格式一致),不返回成功就代表失败,没有这个30分钟以后会重推
}