php.ini 忽略警告,配置php.ini去掉警告信息
@屏蔽掉吧######@ 也没经过大脑呀.######php向java靠拢,注意数据类型(严谨性)是语言完善进步的表现。 ######类型没错呀. 它是传入一个字符串类型,######主要是告诉你这里是错误的吧,不能这样用。######坐等喷子的到来。######你就是个喷子############ http://cn2.php.net/hex2bin 不想看,你可以用@抑制错误输出。
php.ini里配置error_reporting = E_ALL就意味着输出和记录所有错误信息,包括Fatal error、Warning、Notice等各种信息,php.ini配置里有详细的说明:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators. The error level constants are below here for convenience as well as
; some common settings and their meanings.
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP. For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn't be wasting
; resources complaining about best practices and coding standards. That's what
; development servers and development settings are for.
; Note: The php.ini-development file has this setting as E_ALL. This
; means it pretty much reports everything which is exactly what you want during
; development and early testing.
;
; Error Level Constants:
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
; E_ERROR - fatal run-time errors
; E_RECOVERABLE_ERROR - almost fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_STRICT - run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
; E_ALL (Show all errors, warnings and notices including coding standards.)
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
######回复 @eechen : 还能去掉警告的日志? 这是下下下下策呀, 亲.######回复 @Tuesday : 你配置 error_reporting = E_ALL & ~E_WARNING 重启服务,就可以不记录 WARNING 信息。######php log日志会记录在案. 运行久了, 日志里面就全部是这种没意义的警告信息.###### 这个你觉得没意义吗? 我见过不少对执行结果不做任何判断的人。 或许应该抛个异常才能接受。 ######回复 @Tuesday : 第一,程序遇到意外的数据难道不应该记录? 第二,程序遇到意外的数据难道不应该退出? 第三,我没说过让php内置函数抛异常的话,如果很有精力的人可以修改源码重新编译。######回复 @夏涌升 : 求详细,php怎么对内置函数抛出你所谓的异常?######回复 @Tuesday : 什么叫完全没错。。。错误/异常 如果输入的十六进制字符串是奇数长数或者无效的十六进制字符串将会抛出 E_WARNING 级别的错误。 不过要是我,在这个地方我会选择抛出异常。 我不认为返回false是个好主意,如果有人在关键业务拿false去当正常结果用,结果谁都不报异常,你想想有多悲剧。######string hex2bin ( string $data ) 这是手册的说明. 传入参数是字符串, 使用方法完全没错,######如果发生错误就返回false 你如何知道具体的错误信息?动动手try一下 也不会占用你多少时间######try{ echo hex2bin('242'); } catch(Exception $e) { print_r($e); } 求测!!!!!!!!!!!!!!!!!!! php的try更蛋疼.######楼主好腻骇######异常明显比返回值更好用 ######用try试过再说.
php.ini 忽略警告,配置php.ini去掉警告信息相关推荐
- bluehost 虚拟主机 php.ini,BlueHost主机配置Php.ini中文解释(九)
BlueHost主机关于Php.ini配置中文解释,如下: ===================配置指令详解=================== 以下每个指令的设定值都与 PHP-5.2 内建的默 ...
- bluehost 虚拟主机 php.ini,BlueHost主机配置Php.ini中文解释(六)
BlueHost主机关于Php.ini配置中文解释,如下: ===================配置指令详解=================== 以下每个指令的设定值都与 PHP-5.2 内建的默 ...
- Windows--notes.ini文件的配置参数详解
notes.ini文件的配置参数详解 用过LOTUS NOTES的人们都知道NOTES.INI文件对于LOTUS的重要性,但是有关notes.ini的参数设置方面比较少提及.以下总结了NOTES.IN ...
- mysql 5.7.11 my.ini,mysql5.7以上版本配置my.ini的详细步骤
Windows 64 位 mysql 5.7以上版本包解压中没有data目录和my-default.ini和my.ini文件以及服务无法启动的解决办法以及修改初始密码的方法. mysql官网下载地址 ...
- 配置php.ini文件,关闭错误提示,打开错误日志,设置错误日志路径(亲测)
配置php.ini文件,关闭错误提示,打开错误日志,设置错误日志路径 打开php.ini配置文件: 找到display_errors = On:修改为:display_errors = Off: 找到 ...
- 关于PHP上传文件时配置 php.ini 中的 upload_tmp_dir
在<PHP 5.3 入门经典>9.6.3 的试一试中(P235),给出了一个上传文件的例子,这里的文件格式为jpeg图片(image/jpeg).如果之前未配置 php.ini 中的 up ...
- mysql5.7.20官方文档,MySql 5.7.20安装及data和my.ini文件的配置
1.首先上MySql的官网下载 以我所选版本为例(免安装版),选择MYSQL Community Server 然后在右边选择你所对应的版本 我的是64位 下载相应的zip版本 下载完解压到你想要存放 ...
- 【亲测有效】无法定位链接器!请检查 tools\link.ini 中的配置是否正确的解决方案
[亲测有效]无法定位链接器!请检查 tools\link.ini 中的配置是否正确的解决方案 参考文章: (1)[亲测有效]无法定位链接器!请检查 tools\link.ini 中的配置是否正确的解决 ...
- MySQL正确配置my.ini的event_scheduler = ON
MySQL正确配置my.ini的event_scheduler = ON 让事件的定时调度器常开,如下红框圈出部分: 永久性设置方法: 为何要在my.ini中设置: 补充mysql做一个event或j ...
最新文章
- android studio安装在其他盘,Android Studio配置移动到D盘(亲测)
- Asp.net在线统计人数
- HDU3966(树链剖分)
- 为什么同事写的代码那么优雅~
- 10大iOS开发者最喜爱的类库
- 配置 Syslog 守护程序
- Windows三十年进化史,从Windows 1.0到Windows 10
- 管理员需要对此项目进行安全扫描_当ArcGIS Server与Web安全擦出火花??
- 06Matplotlib数据可视化--6.3折线图和柱状图
- this.controls指所有控件吗?_PPT特效制作案例:2019年小目标,你定了吗?(用文本框控件制作)...
- linux minerd 进程,linux中了minerd之后的完全清理过程(详解)
- csgo服务器与客户端文件不匹配,csgo客户端文件与服务器不匹配怎么办
- WebStorm改变字体大小以及更换背景颜色
- 阵列卡服务器装linux,Linux网卡阵列卡安装
- DoT/DoH/DoQ 之 CoreDNS配置
- unity 可视化渲染管线_如何为高端可视化设置Unity的高清渲染管道
- 第一性原理(DFT)基础知识
- matlab 2018b 下载 (for Windows/Linux/Mac)
- 启发式算法Python代码库——scikit-opt
- C#Winform中picturebox控件加载图片后无法释放
热门文章
- java swagger ui 教程_java集成Swagger的步骤详解
- java中为什么同步_如何在Java中同步工作
- 速度极大提升,Arch Linux 计划将 zstd 作为默认压缩算法
- JavaScript按概率随机生成事件
- Netty端口被占用问题
- hadoop常用的端口配置
- 创建界面_《魔兽世界》智慧烈风buff延长 9.0版本角色创建界面改动
- python输入数字输出中文_go格式“占位符”, 输入输出,类似python的input
- 手机自动化测试IDE之Airtest基本操作方法,学完让你解放双手
- 分布式任务队列:Celery使用记录