首頁  >  文章  >  後端開發  >  php7.0.x廢棄的功能

php7.0.x廢棄的功能

L
L轉載
2020-05-27 16:30:052921瀏覽

php7.0.x廢棄的功能

php 7.0.x廢棄的功能

PHP4 風格的建構子

PHP4 風格的建構子(方法名稱和類別名稱一樣)將被棄用,並在未來移除。如果類別中只使用了 PHP4 風格的建構函數,PHP7 會產生 E_DEPRECATED 警告。如果也定義了 __construct() 法則不受影響。

<?php
class foo {
    function foo() {
        echo &#39;I am the constructor&#39;;
    }
}
?>

以上例程會輸出:

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 的方法,未來可能會徹底移除該功能。

<?php
class foo {
    function bar() {
        echo &#39;I am not static!&#39;;
    }
}
foo::bar();
?>

以上例程會輸出:

Deprecated: Non-static method foo::bar() should not be called statically in - on line 8<br>I 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廢棄的功能的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:php.net。如有侵權,請聯絡admin@php.cn刪除