PHP 8.3.4 Released!

Phar::canWrite

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

Phar::canWritephar 拡張モジュールが phar の書き込みや作成をサポートしているかどうかを返す

説明

final public static Phar::canWrite(): bool

このstaticメソッドは、書き込みアクセスが php.ini の phar.readonly で無効にされているかどうかを調べます。

パラメータ

戻り値

書き込みが可能な場合に true、そうでない場合に false を返します。

例1 Phar::canWrite() の例

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

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top