PHP缺点:是属于php程序自身的问题,一样平常是由造孽的语法,环境问题导致的,使得编译器无法通过检讨,乃至无法运行的情形。平时碰着的warming、notice都是缺点,只是级别不同而已。
E_WARNING
这种缺点只是警告,不会终止脚本,程序还会连续进行,显示的缺点信息是Warning。比如include一个不存在的文件。

//Warning: include(a.php): failed to open stream: No such file or directory in /tmp/php/index.php on line 7
//Warning: include(): Failed opening 'a.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /tmp/php/index.php on line 7
include(\公众a.php\"大众); //E_WARNING
。PHP供应了set_error_handler()函数进行缺点处理。当缺点发生时,set_error_handler会统一处理缺点。
如下所示
<?php
$a = 0;
function handle($errno,$errstr,$errfile,$errline){
echo $errfile;
}
set_error_handler('handle');
echo 4/$a;
echo PHP_EOL;
echo 'hehe';
?>
上面的
1
echo 4/$a;发生了缺点,此时进入了缺点处理函数handle中,进行缺点处理,一样平常我们在handle中加入die,终止实行。
E_DEPRECATED
这个缺点表示你用了一个旧版本的函数,而这个函数后期版本可能被禁用或者不掩护了。
比如curl的CURLOPT_POSTFIELDS利用\@FILENAME来上传文件的方法
// Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in /tmp/php/index.php on line 42
$ch = curl_init(\"大众http://www.remotesite.com/upload.php\"大众);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('fileupload' => '@'. \"大众test\公众));
“我们相信大家都可以成为一个IT大神,现在开始,选择一条阳光大道,助你入门,学习的路上不再迷茫。这里是北京尚学堂,初学者转行到IT行业的聚拢地。\公众