代码规范

This commit is contained in:
thinkphp
2016-06-14 23:12:05 +08:00
parent 3d989e6f2c
commit f4bf3620e9

View File

@@ -105,17 +105,16 @@ class Browser
</script> </script>
JS; JS;
echo $js; echo $js;
return true; return true;
} }
public function output($type, $msg){ public function output($type, $msg)
$type = strtolower($type); {
$type = strtolower($type);
$trace_tabs = array_values($this->config['trace_tabs']); $trace_tabs = array_values($this->config['trace_tabs']);
$line[] = ($type == $trace_tabs[0] || '调试' == $type || '错误'== $type)? $line[] = ($type == $trace_tabs[0] || '调试' == $type || '错误'== $type)
"console.group('{$type}');" ? "console.group('{$type}');"
: : "console.groupCollapsed('{$type}');";
"console.groupCollapsed('{$type}');";//dump($msg);
foreach ((array)$msg as $key => $m) { foreach ((array)$msg as $key => $m) {
switch ($type) { switch ($type) {
@@ -138,7 +137,7 @@ JS;
$line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; $line[] = "console.log(\"%c{$msg}\", \"{$style}\");";
break; break;
default: default:
$m = is_string($key)? $key.' '.$m: $key+1 .' '.$m; $m = is_string($key)? $key . ' ' . $m : $key+1 . ' ' . $m;
$msg = str_replace(PHP_EOL, '\n', $m); $msg = str_replace(PHP_EOL, '\n', $m);
$line[] = "console.log(\"{$msg}\");"; $line[] = "console.log(\"{$msg}\");";
break; break;