亲身测试:
返回的时候不要直接返回字符串,要用数组的方式返回数据客户端才能接收。 看代码。
<?php
require_once("../base.php"); function add_order(){
// echo "asdfasfd";
// exit();
// $logger = Logger::getRootLogger();
// $postParam = RequestUtil::postParam("user_id","order_id","type_sale","type_client");
$userID = $_POST['user_id'] ;
$orderID = $_POST['order_id'] ;
$typeSale = $_POST['type_sale'] ;
$typeClient = $_POST['type_client'] ;
$criteoSourceVal = $_POST['criteo_source_val'];
// $logger->trace("新增订单信息===$postParam");
$result = array(
"userID" => $userID,
"orderID" => $orderID,
"typeSale" => $typeSale,
"typeClient" => $typeClient,
"criteoSourceVal" => $criteoSourceVal
);
// echo json_encode("asdf"); 这种方式返回数据网页能接收,curl命令能接收,但是app接收为null
echo json_encode($result);
} main();