一个strict类型的异常为什么“关”不掉

WBOY
Release: 2016-06-13 12:11:44
Original
1098 people have browsed it

一个strict类型的错误为什么“关”不掉?

<br />//我当前是php5.3版<br />//按php.ini中的设置(error_reporting = E_ALL | E_STRICT),<br />//本页会显示2个strict类型的错误(见后面代码注释)<br />//ini_set("error_reporting",E_ALL);		//写这个,只能关闭2号错误提示<br />//ini_set("error_reporting",E_NOTICE);	//写这个也只能关闭2号错误提示<br />//ini_set("display_errors", 0);			//这个还是只能关闭2号错误提示<br /><br />//问题就是:为什么子类跟父类同名但不同参的这个strict错误,为什么关不掉? <br /><br />class Person{<br />	public $name;<br />	public $age;<br />	private function f1($x){<br />		echo "Person中x = " . $x;<br />	}<br />}<br />class Teacher extends Person{<br />	public $depart;	//所属部门<br />	public function f1($x,$y){	//这里方法参数跟父类同名方法不同,<br />								//因此报一个strict类型的错(1号)<br />		echo "Person中x = " . $x , ", y=" . $y ;<br />	}<br />}<br />$o1 = new Teacher();<br />$o1->f1(1,2);<br />$o1::f1(3,4);	//这里使用静态方式调用非静态方法,也报一个strict错(2号)<br />
Copy after login

------解决思路----------------------
error_reporting = E_ALL ^ E_STRICT
------解决思路----------------------
这样可以吗   error_reporting (E_ALL  &  ~ E_STRICT);
------解决思路----------------------
ini_set('display_errors','off');

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template