我有以下代码来回溯错误....但是它
$traces = debug_backtrace();
foreach ($traces as $k => $v)
{
if ($v['function'] == 'include'
|| $v['function'] == 'include_once'
|| $v['function'] == 'require_once'
|| $v['function'] == 'require')
{
$args = '';
if (isset($v['args']) && is_array($v['args']))
{
$size = count($v['args']);
foreach ($v['args'] as $key => $arg)
{
$args .= $v['args'][$key];
if($key < $size)
{
$args .= ', ';
}
}
}
$traces .= '#' . $k . ' '
. $v['function']
. '('.$args.') called at ['
. $v['file'].':'.$v['line'].']';
}
else
{
$function = (array_key_exists('function',$v)) ?
$v['function'].'() ' : 'function_name';
$file = (array_key_exists('file',$v)) ?
$v['file'] : 'file_name';
$line = (array_key_exists('line',$v)) ?
$v['line'] : 'line';
$traces .= "#{$k} $function called at {$file}:{$line}\n";//This line giving me notice...
}
}
我在这里收到数组到字符串转换的通知:
$traces .= "#$k $function called at $file:$line\n";
我实际上想将此数组转换为字符串。是否有任何方法或功能可以在不给我任何通知的情况下进行转换...
我该如何纠正?