문제

I'm having hard time using ZF2 because I cannot use debug_print_backtrace() like I would use it normally.

It is showing me huge amount of data from Zend\Mvc\MvcEvent object. Output looks something like this:

#1  Zend\Mvc\Controller\AbstractActionController->onDispatch(Zend\Mvc\MvcEvent Object ( .... A LOT OF DATA
,[SERVER_SOFTWARE] => Apache/2.2.20 (Ubuntu),[SERVER_NAME] => zf.localhost.com,[SERVER_ADDR] => 127.0.0.1,[SERVER_PORT] => 80, .... SOME SERVER PARAMETERS
Apache/2.2.20 (Ubuntu) Server at zf.localhost.com Port 80
...

Is there a way to not show all this MvcEvent content but still see backtrace with parameters?

도움이 되었습니까?

해결책

If you're just trying to remove the first row (i.e. the MvcEvent), remember - debug_backtrace() returns an array. Nothing prevents you from shifting or popping the data you don't want!

(array_shift() - removes the first element of an array. array_pop() - removes the last. They come in pretty handy in cases like these :-) )

다른 팁

Do you have XDebug installed? I found XDebug invaluable whilst debugging ZF2 issues as you can limit the object depth displayed using var_dump and a few other commands.

An example of this and more information can be found at http://xdebug.org/docs/display

You could then use var_dump(debug_backtrace()) for a less verbose output.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top