如何在zend框架中创建堆栈跟踪?

时间:2011-12-11 11:23:26

标签: php zend-framework stack-trace

zend框架如何进行堆栈跟踪?
堆栈跟踪:

# 0 C: \ apache \ www \ itransition \ library \ Zend \ Controller \ Front.php (954): Zend_Controller_Dispatcher_Standard-> dispatch (Object (Zend_Controller_Request_Http), Object (Zend_Controller_Response_Http))
# 1 C: \ apache \ www \ itransition \ library \ Zend \ Application \ Bootstrap \ Bootstrap.php (97): Zend_Controller_Front-> dispatch ()
# 2 C: \ apache \ www \ itransition \ library \ Zend \ Application.php (366): Zend_Application_Bootstrap_Bootstrap-> run ()
# 3 C: \ apache \ www \ itransition \ index.php (26): Zend_Application-> run ()
# 4 {main}

2 个答案:

答案 0 :(得分:4)

通过捕获抛出的异常,您可以使用Exception::getTraceAsString()

try
{
    throw new Exception('Just testing...');
}
catch (Exception $e)
{
    echo $e->getTraceAsString();
}

答案 1 :(得分:0)

请参阅http://php.net/debug_backtrace

您还可以在评论中找到许多格式示例