PHP如何关闭Notice错误提示

我们在使用wordpress或者一些基于PHP语言开发的网站时,有时页面上会提示一大堆Notice错误信息,使整个网站变得很乱,看起来很糟糕。这时我们需要关闭Notice错误信息。下面介绍一下方法

如果您的服务器是VPS,可以通过修改PHP.ini文件中的error_reporting来实现:

Crayon-5c891d24b40d1607742643" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d24b40d1607742643-1">1
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d24b40d1607742643-1">Crayon-v">error_reportingCrayon-o">=Crayon-v">E_ALLCrayon-h"> Crayon-o">&Crayon-h"> Crayon-o">~Crayon-v">E_NOTICE

如果您不能操作PHP.ini文件,您可以使用如下方法,在您想禁止notice错误提示页面中加入如下代码

Crayon-5c891d24b40da407248215" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d24b40da407248215-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d24b40da407248215-2">2
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d24b40da407248215-1">Crayon-c">/* Report all errors except E_NOTICE */
Crayon-line Crayon-striped-line" id="Crayon-5c891d24b40da407248215-2">Crayon-e">error_reportingCrayon-sy">(Crayon-v">E_ALLCrayon-o">^Crayon-v">E_NOTICECrayon-sy">)Crayon-sy">;

相关文章

WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的...
这两段代码可以让你先体验一下WordPress 3.0的菜单样式 首先在functions.php添加如下代码: register_n...
有人说 WordPress 本身的 SEO 就比较好,我想这个和 WordPress 可以方便的自定义文章的固定链接有分不开...
曾经给大家介绍了在 WordPress 后台移除主题编辑器,今天继续加深,直接关闭 WordPress 后台的文件编辑...
WordPress之iNove主题内容页增加公告栏的方法,导航栏下面默认的公告栏只能在首页显示,只要修改一个文...
大多数WordPress用户都知道该怎么从数千个WordPress主题里挑出自己喜欢,但要自己开发新主题恐怕不是人...