话不多说,直接附上代码
if (!function_exists('dd')) { /** * @notes: 打印输出 * @param mixed $vars * @return void * @author: lavender * @time: 2024/7/15 9:33 */ function dd(...$vars) { /*ob_start(); var_dump($data); $output = ob_get_clean(); $output = preg_replace("/]\=\>\n(\s+)/m", "] => ", $output); $output = '<pre style="background: #18171b; color: #56db3a; font-family: Consolas, Monaco, monospace; padding: 1em;font-size: 14px;">' . $output . '</pre>'; echo $output; die;*/ ob_start(); var_dump(...$vars); $output = ob_get_clean(); $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); if (PHP_SAPI == 'cli') { $output = PHP_EOL . $output . PHP_EOL; } else { if (!extension_loaded('xdebug')) { $output = htmlspecialchars($output, ENT_SUBSTITUTE); } $output = '<pre style="background: #18171b; color: #56db3a; font-family: Consolas, Monaco, monospace; padding: 1em;font-size: 14px;">' . $output . '</pre>'; } echo $output; die; } }
标签:打印输出,vars,ob,程序执行,output,PHP From: https://www.cnblogs.com/shemmor/p/18424043