2011-12-11 40 views
2

zend框架如何做一个堆栈跟踪?
堆栈跟踪:如何在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} 

回答

4

通过捕获抛出的异常许多格式的例子,你可以使用Exception::getTraceAsString()

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