PHP_api接口教程(8)
发布时间:2021-06-06
发布时间:2021-06-06
{
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue) {
$respObject = $propValue; } } }
else if("xml" == $this->format) {
$respObject = @simplexml_load_string($resp); if (false !== $respObject) {
$respWellFormed = true; } }
//返回的 HTTP 文本不是标准 JSON 或者 XML,记下错误日志 if (false === $respWellFormed) {
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_ NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED"; return $result; }
//如果 TOP 返回了错误码,记录到业务错误日志中 if (isset($respObject->code)) {
$logger = new LtLogger; $logger->conf["log_file"] =
rtrim(TOP_SDK_WORK_DIR,
'\\/')
.
'/'
"logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"), $resp )); }
return $respObject; }
.