改进Response类的send方法 去除 REQUEST_METHOD IS_GET IS_POST IS_PUT IS_DELETE IS_AJAX __EXT__ 常量 由应用自己定义

This commit is contained in:
thinkphp
2016-06-02 12:13:00 +08:00
parent ee9d5df56f
commit 8099a001e2
7 changed files with 63 additions and 32 deletions

View File

@@ -15,6 +15,7 @@ use think\Cache;
use think\Config;
use think\Db;
use think\Debug;
use think\Request;
/**
* 页面Trace调试
@@ -41,10 +42,11 @@ class Trace
*/
public function save(array $log = [])
{
if (IS_CLI || IS_AJAX || IS_API || (defined('RESPONSE_TYPE') && !in_array(RESPONSE_TYPE, ['html', 'view']))) {
if (IS_CLI || IS_API || Request::instance()->isAjax() || (defined('RESPONSE_TYPE') && !in_array(RESPONSE_TYPE, ['html', 'view']))) {
// ajax cli api方式下不输出
return false;
}
// 获取基本信息
$runtime = microtime(true) - START_TIME;
$reqs = number_format(1 / number_format($runtime, 8), 2);