Commit dad94e48 authored by 杨培's avatar 杨培

优化调试信息输出

parent 294541b6
...@@ -230,29 +230,34 @@ class Client ...@@ -230,29 +230,34 @@ class Client
curl_close($ci); curl_close($ci);
if ($this->debug) { if ($this->debug) {
echo "<pre>\r\n=====INFO=====\r\n"; $info = "=====INFO=====\r\n"
echo "Request URL: $url\r\n", ."Request URL: $url\r\n"
"Remote Address: {$httpInfo['primary_ip']}:{$httpInfo['primary_port']}\r\n", ."Remote Address: {$httpInfo['primary_ip']}:{$httpInfo['primary_port']}\r\n"
"Local Address: {$httpInfo['local_ip']}:{$httpInfo['local_port']}\r\n", ."Local Address: {$httpInfo['local_ip']}:{$httpInfo['local_port']}\r\n"
"Namelookup Time: {$httpInfo['namelookup_time']}\r\n", ."Namelookup Time: {$httpInfo['namelookup_time']}\r\n"
"Connect Time: {$httpInfo['connect_time']}\r\n", ."Connect Time: {$httpInfo['connect_time']}\r\n"
"Pre Transfer Time: {$httpInfo['pretransfer_time']}\r\n", ."Pre Transfer Time: {$httpInfo['pretransfer_time']}\r\n"
"Start Transfer Time: {$httpInfo['starttransfer_time']}\r\n", ."Start Transfer Time: {$httpInfo['starttransfer_time']}\r\n"
"File Time: {$httpInfo['filetime']}\r\n", ."File Time: {$httpInfo['filetime']}\r\n"
"Total Time: {$httpInfo['total_time']}\r\n"; ."Total Time: {$httpInfo['total_time']}\r\n";
if (isset($errno)) { if (isset($errno)) {
echo "\r\n=====ERROR=====\r\nErrorNo: $errno\r\nErrorMsg: $errmsg\r\n"; $info .= "\r\n=====ERROR=====\r\nErrorNo: $errno\r\nErrorMsg: $errmsg\r\n";
} }
echo "\r\n=====REQUEST=====\r\n",$httpInfo['request_header']; $info .= "\r\n=====REQUEST=====\r\n{$httpInfo['request_header']}";
if (isset($body)) { if (isset($body)) {
echo $body."\r\n"; $info .= $body."\r\n";
} }
echo "\r\n=====RESPONSE=====\r\n",$responseHeaders,$response; $info .= "\r\n=====RESPONSE=====\r\n{$responseHeaders}{$response}";
echo "\r\n</pre>";
if (PHP_SAPI == 'cli' || (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') || empty($_SERVER['HTTP_USER_AGENT'])) {
echo $info."\r\n";
} else {
echo '<pre>' . htmlspecialchars($info) . '</pre>';
}
} }
return [$httpCode, $response]; return [$httpCode, $response];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment