您的位置 首页 技术

php7.0.x废弃的功能

php 7.0.x废弃的功能 PHP4 风格的构造函数 PHP4 风格的构造函数(方法名和类名一样)将被弃用,并在将来移除。 如果在类中仅使用了 PHP4 风格的构造函数,PHP7…

php 7.0.x废弃的功能

PHP4 风格的构造函数

PHP4 风格的构造函数(方法名和类名一样)将被弃用,并在将来移除。 如果在类中仅使用了 PHP4 风格的构造函数,PHP7 会产生 E_DEPRECATED 警告。 如果还定义了 __construct() 方法则不受影响。

<?phpclass 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 的方法,未来可能会彻底移除该功能。

<?phpclass foo {    function bar() {        echo 'I am not static!';    }}foo::bar();?>

以上例程会输出:

Deprecated: Non-static method foo::bar() should not be called statically in - on line 8I am not static!

password_hash() 盐值选项

废弃了 password_hash() 函数中的盐值选项,阻止开发者生成自己的盐值(通常更不安全)。 开发者不传该值时,该函数自己会生成密码学安全的盐值。因此再无必要传入自己自定义的盐值。

capture_session_meta SSL 上下文选项

废弃了 capture_session_meta 内的 SSL 上下文选项。 现在可以通过 stream_get_meta_data() 获取 SSL 元数据(metadata)。

LDAP 中的废弃

以下函数已被废弃:

ldap_sort()

推荐教程:《PHP7》《PHP教程》

以上就是php7.0.x废弃的功能的详细内容,更多请关注24课堂在线网其它相关文章!

本文来自网络,不代表24小时课堂在线立场,转载请注明出处:https://www.24ketang.cn/64694.html

为您推荐

返回顶部