src/AppBundle/Common/ExceptionPrintingToolkit.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Common;
use Symfony\Component\Debug\Exception\FlattenException;
class ExceptionPrintingToolkit
{
public static function printTraceAsArray($exception)
{
if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}
$error['previous'] = array();
$flags = PHP_VERSION_ID >= 50400 ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES;
$count = count($exception->getAllPrevious());
$total = $count + 1;
foreach ($exception->toArray() as $position => $e) {
$previous = array();
$ind = $count - $position + 1;
$previous['message'] = "{$ind}/{$total} {$e['class']}: {$e['message']}";
$previous['trace'] = array();
foreach ($e['trace'] as $pos => $trace) {
$content = sprintf('%s. ', $pos + 1);
if ($trace['function']) {
$content .= sprintf('at %s%s%s(%s)', $trace['class'], $trace['type'], $trace['function'], '...args...');
}
if (isset($trace['file']) && isset($trace['line'])) {
$content .= sprintf(' in %s line %d', htmlspecialchars($trace['file'], $flags, 'UTF-8'), $trace['line']);
}
$previous['trace'][] = $content;
}
$error['previous'][] = $previous;
}
return $error;
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。