简体   繁体   中英

how to display custom error page in Zend

i already set up log streamer in .htaccess, and disabled logs @ production so logs comes the way i want to see them. But how to display any custom error screen for visitors? Now i got blank page. Any sugestions?

Cheers, ad

Do a try{...}catch{...} when a error occurs and then set a custom error message. You should have something like this:

Controller

try
{
   // stuff
}
catch(Zend_Exception $Ex)
{
   $this->view->Error = 'My custom error';
}

View

if ($this->Error !== null)
   echo 'Error: ' . $this->Error;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM