mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正异常模板
This commit is contained in:
@@ -1,3 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
if(!function_exists('parse_padding')){
|
||||||
|
function parse_padding($source)
|
||||||
|
{
|
||||||
|
$length = strlen(strval(count($source['source']) + $source['first']));
|
||||||
|
return 40 + ($length - 1) * 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('parse_class')){
|
||||||
|
function parse_class($name)
|
||||||
|
{
|
||||||
|
$names = explode('\\', $name);
|
||||||
|
return '<abbr title="'.$name.'">'.end($names).'</abbr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('parse_file')){
|
||||||
|
function parse_file($file, $line)
|
||||||
|
{
|
||||||
|
return '<a class="toggle" title="'."{$file} line {$line}".'">'.basename($file)." line {$line}".'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('parse_args')){
|
||||||
|
function parse_args($args)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($args as $key => $item) {
|
||||||
|
switch (true) {
|
||||||
|
case is_object($item):
|
||||||
|
$value = sprintf('<em>object</em>(%s)', parse_class(get_class($item)));
|
||||||
|
break;
|
||||||
|
case is_array($item):
|
||||||
|
if(count($item) > 3){
|
||||||
|
$value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3)));
|
||||||
|
} else {
|
||||||
|
$value = sprintf('[%s]', parse_args($item));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case is_string($item):
|
||||||
|
if(strlen($item) > 20){
|
||||||
|
$value = sprintf(
|
||||||
|
'\'<a class="toggle" title="%s">%s...</a>\'',
|
||||||
|
htmlentities($item),
|
||||||
|
htmlentities(substr($item, 0, 20))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$value = sprintf("'%s'", htmlentities($item));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case is_int($item):
|
||||||
|
case is_float($item):
|
||||||
|
$value = $item;
|
||||||
|
break;
|
||||||
|
case is_null($item):
|
||||||
|
$value = '<em>null</em>';
|
||||||
|
break;
|
||||||
|
case is_bool($item):
|
||||||
|
$value = '<em>' . ($item ? 'true' : 'false') . '</em>';
|
||||||
|
break;
|
||||||
|
case is_resource($item):
|
||||||
|
$value = '<em>resource</em>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = htmlentities(str_replace("\n", '', var_export(strval($item), true)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result[] = is_int($key) ? $value : "'{$key}' => {$value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(', ', $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -399,72 +476,4 @@
|
|||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php
|
|
||||||
function parse_padding($source)
|
|
||||||
{
|
|
||||||
$length = strlen(strval(count($source['source']) + $source['first']));
|
|
||||||
return 40 + ($length - 1) * 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parse_class($name)
|
|
||||||
{
|
|
||||||
$names = explode('\\', $name);
|
|
||||||
return '<abbr title="'.$name.'">'.end($names).'</abbr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function parse_file($file, $line)
|
|
||||||
{
|
|
||||||
return '<a class="toggle" title="'."{$file} line {$line}".'">'.basename($file)." line {$line}".'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function parse_args($args)
|
|
||||||
{
|
|
||||||
$result = [];
|
|
||||||
|
|
||||||
foreach ($args as $key => $item) {
|
|
||||||
switch (true) {
|
|
||||||
case is_object($item):
|
|
||||||
$value = sprintf('<em>object</em>(%s)', parse_class(get_class($item)));
|
|
||||||
break;
|
|
||||||
case is_array($item):
|
|
||||||
if(count($item) > 3){
|
|
||||||
$value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3)));
|
|
||||||
} else {
|
|
||||||
$value = sprintf('[%s]', parse_args($item));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case is_string($item):
|
|
||||||
if(strlen($item) > 20){
|
|
||||||
$value = sprintf(
|
|
||||||
'\'<a class="toggle" title="%s">%s...</a>\'',
|
|
||||||
htmlentities($item),
|
|
||||||
htmlentities(substr($item, 0, 20))
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$value = sprintf("'%s'", htmlentities($item));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case is_int($item):
|
|
||||||
case is_float($item):
|
|
||||||
$value = $item;
|
|
||||||
break;
|
|
||||||
case is_null($item):
|
|
||||||
$value = '<em>null</em>';
|
|
||||||
break;
|
|
||||||
case is_bool($item):
|
|
||||||
$value = '<em>' . ($item ? 'true' : 'false') . '</em>';
|
|
||||||
break;
|
|
||||||
case is_resource($item):
|
|
||||||
$value = '<em>resource</em>';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$value = htmlentities(str_replace("\n", '', var_export(strval($item), true)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result[] = is_int($key) ? $value : "'{$key}' => {$value}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(', ', $result);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user