在线咨询
微信咨询
服务热线
服务热线:15639912513
TOP
当前位置:
首页 > 新闻中心> PHP课堂>ThinkPHP5提示模块不存在解决思路

ThinkPHP5提示模块不存在解决思路

发布时间:2019-07-13 浏览:12692次

在处理客户高端网站定制问题中,遇到提示模块不存在。

那么如何屏蔽这个遇到异常的提示错误信息呢?

第一种方法,修改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方法中,替换其中的代码。如果在遇到提示信息,直接跳转到首页。

TAG
12692
该内容对我有帮助