PHP 7 廢棄特性
PHP4 風(fēng)格的建構(gòu)子
在 PHP4 中類別的函數(shù)可以與類別名稱同名,這個(gè)特性在 PHP7 中被廢棄,同時(shí)會(huì)發(fā)出一個(gè) E_DEPRECATED 錯(cuò)誤。當(dāng)方法名稱與類別名稱相同,且類別不在命名空間中,同時(shí)PHP5的建構(gòu)子(__construct)不存在時(shí),會(huì)產(chǎn)生一個(gè) E_DEPRECATED 錯(cuò)誤。
實(shí)例
<?php class A { function A() { print('Style Constructor'); } } ?>以上程式執(zhí)行輸出結(jié)果為:
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...
以靜態(tài)的方式呼叫非靜態(tài)方法
#以靜態(tài)的方式呼叫非靜態(tài)方法,不再支援:
實(shí)例
<?php class A { function b() { print('Non-static call'); } } A::b(); ?>
以上程式執(zhí)行輸出結(jié)果為:
Deprecated: Non-static method A::b() should not be called statically in... Non-static call
password_hash() 隨機(jī)因子選項(xiàng)
函數(shù)原salt 量不再需要由開(kāi)發(fā)者提供了。函數(shù)內(nèi)部預(yù)設(shè)帶有 salt 能力,無(wú)需開(kāi)發(fā)者提供 salt 值。
capture_session_meta SSL 上下文選項(xiàng)
廢棄了 "capture_session_meta" SSL 上下文選項(xiàng)。 在串流資源上活動(dòng)的加密相關(guān)的元資料可以透過(guò) stream_get_meta_data() 的回傳值來(lái)存取。