在处理客户高端网站定制问题中,遇到提示模块不存在。
那么如何屏蔽这个遇到异常的提示错误信息呢?
第一种方法,修改thinkphp中的异常文件。
public function render (Exception $e)
{
if ( $e instanceof HttpException ) {
$statusCode = $e->getStatusCode ();
if ( stristr ($e->getMessage (), "module not exists:") ) {
return Response::create ("
", "html")->send ();
}
}
//可以在此交由系统处理
return parent::render ($e);
}
这段代码不能直接添加,需要复制其中的一段。
if ( $e instanceof HttpException ) {
$statusCode = $e->getStatusCode ();
if ( stristr ($e->getMessage (), "module not exists:") ) {
return Response::create ("
", "html")->send ();
}
}
这段代码复制一下,粘贴到Handle.php中的render方法中,替换其中的代码。如果在遇到提示信息,直接跳转到首页。