Hide Stack Trace in Exception Response in PHP/Zend
I'm wondering if there is a way to hide the stack trace in an Exception in PHP. I'm running a Zend Amf Server开发者_如何学JAVA under ZF and would like to handle the faults on the front-end but showing the stack trace (faultDetail) isn't something I want to come across the line.
My next step is to over ride these faults and send my own object back, but I would rather over ride an Exception to just not show the trace.
The stack trace is part of your ErrorController.php and /views/scripts/error
view scripts. Most people forget that they have created it once and can do with it whatever they please.
Also note that you usually use environments in ZF. With APPLICATION_ENV you can use them to show or hide events depending on your environment.
You can write your own exception handler function which will do whatever you wish: http://php.net/manual/en/function.set-exception-handler.php
You can rewrite error.phtml
which, by default, is at application\views\scripts\error\error.phtml
to show whatever messages you want.
Look at application/controllors/ErrorController.php
to see how uncaught exceptions are handled.
精彩评论