调整变量的输出

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
// +----------------------------------------------------------------------
// | 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;
use think\Cache;
use think\Config;
@@ -116,14 +124,11 @@ JS;
foreach ($msg as $key => $m) {
switch ($type) {
case '调试':
//我多么希望进来的是原数据格式而不是字符串
if(substr($m, 0, 5) == 'array'){
eval("\$o = $m;");
$line[] = "console.log(".json_encode($o).");";
$var_type = gettype($m);
if(in_array($var_type, ['array', 'string'])){
$line[] = "console.log(".json_encode($m).");";
}else{
$msg = addslashes($m);
$msg = str_replace(PHP_EOL, '\n', $msg);
$line[] = "console.log('$msg');";
$line[] = "console.log(".json_encode(var_export($m, 1)).");";
}
break;
case '错误':