PHP 7 废弃特性

4123 1
LZH实名认证 2022-4-9 20:48:09 | 显示全部楼层 |阅读模式
PHP4 风格的构造函数
在 PHP4 中类中的函数可以与类名同名,这一特性在 PHP7 中被废弃,同时会发出一个 E_DEPRECATED 错误。当方法名与类名相同,且类不在命名空间中,同时PHP5的构造函数(__construct)不存在时,会产生一个 E_DEPRECATED 错误。

实例
实例
<?php
class A {
   function A() {
      print('Style Constructor');
   }
}
?>
以上程序执行输出结果为:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in...
以静态的方式调用非静态方法
以静态的方式调用非静态方法,不再支持:

实例
实例
<?php
class A {
   function b() {
      print('Non-static call');
   }
}
A::b();
?>
以上程序执行输出结果为:

Deprecated: Non-static method A::b() should not be called statically in...
Non-static call
password_hash() 随机因子选项
函数原 salt 量不再需要由开发者提供了。函数内部默认带有 salt 能力,无需开发者提供 salt 值。

capture_session_meta SSL 上下文选项
废弃了 "capture_session_meta" SSL 上下文选项。 在流资源上活动的加密相关的元数据可以通过 stream_get_meta_data() 的返回值访问。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行