Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: posix_access - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

posix_ctermid" width="11" height="7"/> <POSIX 関数
Last updated: Fri, 05 Sep 2008

view this page in

posix_access

(PHP 5 >= 5.1.0)

posix_access ファイルのアクセス権限を判断する

説明

bool posix_access ( string $file [, int $mode ] )

posix_access() は、ファイルに対するユーザの アクセス権限を調べます。

パラメータ

file

調べるファイルの名前。

mode

POSIX_F_OKPOSIX_R_OKPOSIX_W_OK および POSIX_X_OK のうちのひとつあるいは複数からなるマスク。 デフォルトは POSIX_F_OK です。

POSIX_R_OKPOSIX_W_OK および POSIX_X_OK は、ファイルが存在して読み込み/書き込み/ 実行の権限があるかどうかを調べます。 POSIX_F_OK は単にファイルが存在するかどうか だけを調べます。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 posix_access() の例

この例は $file が読み書き可能であるかどうかを調べ、 そうでない場合にエラーメッセージを表示します。

<?php

$file 
'some_file';

if (
posix_access($filePOSIX_R_OK POSIX_W_OK)) {
    echo 
'このファイルの読み込みと書き込みが可能です!';

} else {
    
$error posix_get_last_error();

    echo 
"エラー $error: " posix_strerror($error);
}

?>

注意

注意: セーフモード が有効の場合、PHP は操作を行うファイル/ディレクトリが実行するスクリプトと 同じ UID (所有者)を有しているかどうかを確認します。



add a note add a note User Contributed Notes
posix_access
There are no user contributed notes for this page.

posix_ctermid" width="11" height="7"/> <POSIX 関数
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites