designModeDemo/index.php

36 lines
820 B
PHP

<?php
const ROOTDIR = __DIR__;
/**
* 输出字符串或数组
*
* @param string/array $vars 输出字符串或数组
* @param string $label 提示标题
* @param bool|string $return 是否有返回值
*/
function dump($vars, bool|string $return = false, string $label = '')
{
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true), ENT_COMPAT, 'ISO-8859-1');
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
echo $content;
if ($return) exit;
return null;
}
require ROOTDIR . '/bin/Psr4Autoload.php';
(new \bin\Psr4Autoload)->register();
(new \bin\Base);