diff --git a/application/common.php b/application/common.php index f60a28d032840cddbd654d82dffe601d01e18bf5..95398b42dee9ac980dfa378c7996efd580f7ee40 100755 --- a/application/common.php +++ b/application/common.php @@ -362,3 +362,28 @@ if (!function_exists('hsv2rgb')) { ]; } } + +if (!function_exists('console')) { + /** + * 控制台输出 + * @param $var + * @param string $level + */ + function console($var, $level = 'log') + { + if (is_array($var) || is_object($var)) { + $output = json_encode($var); + $jsonDecode = json_decode($output); + if (empty((array) $jsonDecode) && !empty($var)) { + echo ""; + return; + } + } elseif (is_string($var)) { + $output = '"' . $var . '"'; + } else { + $output = $var; + } + echo ""; + return; + } +} \ No newline at end of file