调整变量的输出

This commit is contained in:
jay
2016-06-14 15:02:45 +08:00
committed by GitHub
parent 5e7c8e9902
commit af4e544937

View File

@@ -1,5 +1,13 @@
<?php <?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yangweijie <yangweijiester@gmail.com>
// +----------------------------------------------------------------------
namespace think\log\driver; namespace think\log\driver;
use think\Cache; use think\Cache;
use think\Config; use think\Config;
@@ -116,14 +124,11 @@ JS;
foreach ($msg as $key => $m) { foreach ($msg as $key => $m) {
switch ($type) { switch ($type) {
case '调试': case '调试':
//我多么希望进来的是原数据格式而不是字符串 $var_type = gettype($m);
if(substr($m, 0, 5) == 'array'){ if(in_array($var_type, ['array', 'string'])){
eval("\$o = $m;"); $line[] = "console.log(".json_encode($m).");";
$line[] = "console.log(".json_encode($o).");";
}else{ }else{
$msg = addslashes($m); $line[] = "console.log(".json_encode(var_export($m, 1)).");";
$msg = str_replace(PHP_EOL, '\n', $msg);
$line[] = "console.log('$msg');";
} }
break; break;
case '错误': case '错误':