码迷,mamicode.com
首页 > 其他好文 > 详细

eyoucms自定义404页面

时间:2020-04-12 14:02:37      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:需要   简单   http   原来   sig   自定义   you   rar   目录   

404个性化页面自定义是我们很多时候都会有的需求,修改的办法也很简单,修改后记得自己拿小本本记着,下次系统更新如果被覆盖了,还可以再改回来,自定义404页面,PC、手机都可自己判断地址。

方法:
Core/library/think/exception/handle.php 找到方法 renderHttpException
对原来的if判断进行一下改良,结果如下:
地址自动切换到pc/mobile目录下,所以两个目录都要有自己的404.html

if(‘404‘ == $status){
    $mytemplate = \think\Config::get(‘template.view_path‘);
    $mytemplate = ROOT_PATH.$mytemplate.‘404.htm‘;
    return Response::create($mytemplate, ‘view‘, $status)->assign([‘e‘ => $e]);
} elseif (!empty($template[$status])) {
    return Response::create($template[$status], ‘view‘, $status)->assign([‘e‘ => $e]);
} else {
        return $this->convertExceptionToResponse($e);
}

好了,这是二开办法,需要做成插件可以留言讨论

eyoucms自定义404页面

标签:需要   简单   http   原来   sig   自定义   you   rar   目录   

原文地址:https://blog.51cto.com/14747960/2486651

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!