2024 年日本 PHP 研討會

Phar::canWrite

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)

Phar::canWrite傳回 phar 擴充功能是否支援寫入和建立 phar 檔案

說明

final public static Phar::canWrite(): bool

這個靜態方法會判斷是否已透過 phar.readonly ini 變數在系統 php.ini 中停用寫入權限。

參數

傳回值

如果啟用寫入權限,則傳回 true,如果停用,則傳回 false

範例

範例 #1 Phar::canWrite() 範例

<?php
if (Phar::canWrite()) {
file_put_contents('phar://myphar.phar/file.txt', 'hi there');
}
?>

另請參閱

新增註釋

使用者提供的註釋

此頁面沒有使用者提供的註釋。
To Top