PHP7.0.x中哪些废弃功能不再被支持?
- 内容介绍
- 文章标签
- 相关推荐
本文共计456个文字,预计阅读时间需要2分钟。
PHP 7.0.x废弃的功能包括PHP4风格的构造函数(方法名和类名相同)。这些构造函数将在未来版本中移除。如果类中仅使用了PHP4风格的构造函数,PHP7将产生E_DEPRECATED警告。
php 7.0.x废弃的功能
PHP4 风格的构造函数
PHP4 风格的构造函数(方法名和类名一样)将被弃用,并在将来移除。 如果在类中仅使用了 PHP4 风格的构造函数,PHP7 会产生 E_DEPRECATED 警告。 如果还定义了 __construct() 方法则不受影响。
<?php class foo { function foo() { echo 'I am the constructor'; } } ?>
以上例程会输出:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example.php on line 3
静态调用非静态的方法
废弃了 静态(Static) 调用未声明成 static 的方法,未来可能会彻底移除该功能。
本文共计456个文字,预计阅读时间需要2分钟。
PHP 7.0.x废弃的功能包括PHP4风格的构造函数(方法名和类名相同)。这些构造函数将在未来版本中移除。如果类中仅使用了PHP4风格的构造函数,PHP7将产生E_DEPRECATED警告。
php 7.0.x废弃的功能
PHP4 风格的构造函数
PHP4 风格的构造函数(方法名和类名一样)将被弃用,并在将来移除。 如果在类中仅使用了 PHP4 风格的构造函数,PHP7 会产生 E_DEPRECATED 警告。 如果还定义了 __construct() 方法则不受影响。
<?php class foo { function foo() { echo 'I am the constructor'; } } ?>
以上例程会输出:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example.php on line 3
静态调用非静态的方法
废弃了 静态(Static) 调用未声明成 static 的方法,未来可能会彻底移除该功能。

