tp5.1页面报错打不开报警
tp5.1页面打不开,程序出错自动通知程序设计
ThinkPHP 5.1页面报错文件及路径为:
// 异常页面的模板文件 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl',
预警处理路径为:/thinkphp/library/think/exception/Handle.php
在如下代码后加入预警程序:
include Container::get('app')->config('exception_tmpl');
以下以微信通知为例:
$url = explode("/",$_SERVER['REQUEST_URI']); $url = $url[1]; $check = array("","domain", "host", "user", "cloud");//检测主要的目录,其他目录报错不通知 if (in_array($url, $check)){ $status = $_SERVER['HTTP_USER_AGENT']; $type = '异常报错'; $str = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $wx = new Wx();//发微信通知 $res = $wx->send_cron_msg('wxid',$type,$status,$str,$str); }
本文属原创,转载请注明原文:https://www.zhimatong.com/jiaocheng/243.html
为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。
内容有用
热门主题
相关阅读
- PbootCMS网站常见报错/错误提示及解决方法集合(持续更新)
- ThinkPHP页面提示Warning: require(): open_basedir restriction in effect. File的解决方法
- 解决网站JQ提示"Failed to load resource: the server responded with a status of 404 (Not Found)"的问题
- vue-router 报错:Navigation cancelled from“/...“ to “/...“ with a new navigation.的3个解决方案
- PbootCMS提示URL名称与模型URL名称冲突,请换一个名称!的解决方法
- 检测到您模板中包含文件超过50个,请检查是否存在互相包含导致无限循环的情况!