PHP Conference Japan 2024

openssl_free_key

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

openssl_free_key釋放金鑰資源

警告

此函式自 PHP 8.0.0 起已被棄用。強烈建議不要依賴此函式。

說明

#[\Deprecated]
openssl_free_key(OpenSSLAsymmetricKey $key): void

openssl_free_key() 從記憶體中釋放與指定的 key 相關聯的金鑰。

參數

key

回傳值

不回傳任何值。

更新日誌

版本 說明
8.0.0 此函式現已棄用,因為它不再有任何作用。
8.0.0 key 現在接受 OpenSSLAsymmetricKey;先前接受類型為 OpenSSL key資源
新增筆記

使用者貢獻的筆記 2 則筆記

Lawri van Bul
7 年前
我剛檢查了 PHP 7.1 的程式碼,其中的 openssl_free_key 是 opnessl_pkey_free 的別名 (PHP_FALIAS)。

這支持了 Richard 的假設。

我也建議不要使用別名,
而是在新的程式碼中使用 openssl_pkey_free 函式。

這是因為它更清楚地描述了它的用途,並且與 openssl 區段中的類似函式具有相同的結構。
Richard Lynch
11 年前
openssl_free_key 和 openssl_pkey_free 可能是別名。

而首選的可能是 openssl_pkey_free。
To Top