php 7.0.x廢棄的功能
PHP4 風(fēng)格的構(gòu)造函數(shù)
PHP4 風(fēng)格的構(gòu)造函數(shù)(方法名和類(lèi)名一樣)將被棄用,并在將來(lái)移除。 如果在類(lèi)中僅使用了 PHP4 風(fēng)格的構(gòu)造函數(shù),PHP7 會(huì)產(chǎn)生 E_DEPRECATED 警告。 如果還定義了 __construct() 方法則不受影響。
<?php class foo { function foo() { echo 'I am the constructor'; } } ?>
以上例程會(huì)輸出:
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
靜態(tài)調(diào)用非靜態(tài)的方法
廢棄了 靜態(tài)(Static) 調(diào)用未聲明成 static 的方法,未來(lái)可能會(huì)徹底移除該功能。
<?php class foo { function bar() { echo 'I am not static!'; } } foo::bar(); ?>
以上例程會(huì)輸出:
Deprecated: Non-static method foo::bar() should not be called statically in - on line 8
I am not static!
password_hash() 鹽值選項(xiàng)
廢棄了 password_hash() 函數(shù)中的鹽值選項(xiàng),阻止開(kāi)發(fā)者生成自己的鹽值(通常更不安全)。 開(kāi)發(fā)者不傳該值時(shí),該函數(shù)自己會(huì)生成密碼學(xué)安全的鹽值。因此再無(wú)必要傳入自己自定義的鹽值。
capture_session_meta SSL 上下文選項(xiàng)
廢棄了 capture_session_meta 內(nèi)的 SSL 上下文選項(xiàng)。 現(xiàn)在可以通過(guò) stream_get_meta_data() 獲取 SSL 元數(shù)據(jù)(metadata)。
LDAP 中的廢棄
以下函數(shù)已被廢棄:
ldap_sort()
推薦教程:《PHP7》《PHP教程》