ユーザ用ツール

サイト用ツール


サイドバー


メニュー




スポンサーリンク





php:関数使用例:ファイルシステム:file_exists

PHP:関数使用例:ファイルシステム:file_exists

分類

ファイルシステム

機能

ファイルまたはディレクトリが存在するかどうか調べる

sample

ソース

<html>
<head>
<title>t_file_exist.php</title>
<body>
<?php
$file_name ="/home/hoge/public_html/test/test.txt";
if(file_exists($file_name)){
  echo "ファイル(".$file_name.")あり";
 
}else{
  echo "ファイル(".$file_name.")なし";
}
?>
</body>
</html>

出力結果

ファイル(/home/hoge/public_html/test/test.txt)あり 
php/関数使用例/ファイルシステム/file_exists.txt · 最終更新: 2015/12/08 02:04 by dokuroot