trippest json_encode 中文字符

feature/pay
lyt 7 years ago
parent b0bc0bc7a9
commit 362c718416

@ -48,9 +48,9 @@ class TulanduoApi extends CI_Controller
public function __construct(){
parent::__construct();
$this->load->helper('array');
$this->load->model('Orders_model');
$this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
$this->load->helper('array');
// $this->output->enable_profiler(TRUE);
@ -129,7 +129,7 @@ class TulanduoApi extends CI_Controller
}
$PAG_Code = in_array($PAG_Code, array("SHALC-6","SHALC-7","SHALC-8","SHALC-9")) ? "SHSIC-45" : $PAG_Code;
$serviceSN = $this->Orders_model->get_packageSN($PAG_Code);
$COLD_MemoText = json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic']));
$COLD_MemoText = raw_json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic']));
$this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null;
$this->Orders_model->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过
@ -540,4 +540,5 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
,"上海单租车(目的地)" => "SHSIC-45" //"SHALC-6,7,8,9"
);
}
}

@ -90,3 +90,21 @@ function my_implode($container,$se,$arr)
}
return $str;
}
/*!
* json_encode($a, JSON_UNESCAPED_UNICODE )
* for PHP Version < 5.4
*/
function raw_json_encode($input, $flags = 0) {
$fails = implode('|', array_filter(array(
'\\\\',
$flags & JSON_HEX_TAG ? 'u003[CE]' : '',
$flags & JSON_HEX_AMP ? 'u0026' : '',
$flags & JSON_HEX_APOS ? 'u0027' : '',
$flags & JSON_HEX_QUOT ? 'u0022' : '',
)));
$pattern = "/\\\\(?:(?:$fails)(*SKIP)(*FAIL)|u([0-9a-fA-F]{4}))/";
$callback = function ($m) {
return html_entity_decode("&#x$m[1];", ENT_QUOTES, 'UTF-8');
};
return preg_replace_callback($pattern, $callback, json_encode($input, $flags));
}

@ -1672,4 +1672,5 @@ class Orders_model extends CI_Model {
}
}

Loading…
Cancel
Save