0

PHP7 废弃特性

Posted by 撒得一地 on 2016年3月27日 in PHP笔记

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() 的返回值访问。

上一篇:

下一篇:

相关推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注

7 + 2 = ?

网站地图|XML地图

Copyright © 2015-2024 技术拉近你我! All rights reserved.
闽ICP备15015576号-1 版权所有©psz.