我正在嘗試讀取Linux下/ var/www/myDir下的.conf文件。.conf通過php找不到
這是它說找不到文件的代碼
$confFile = "vhost.conf";
if (file_exists($confFile)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
。任何想法,爲什麼>
感謝 讓
我正在嘗試讀取Linux下/ var/www/myDir下的.conf文件。.conf通過php找不到
這是它說找不到文件的代碼
$confFile = "vhost.conf";
if (file_exists($confFile)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
。任何想法,爲什麼>
感謝 讓
給的完整路徑
$confFile = "/var/www/myDir/vhost.conf";
是你的腳本在同一路徑執行?否則請嘗試使用完整路徑
if (file_exists('/var/www/myDir'. $confFile)) {
...
嘗試使用絕對路徑,像這樣:
$confFile = $_SERVER['DOCUMENT_ROOT'] . "/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; }
或者,也許這樣的:
$confFile = "/var/www/myDir/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; }
硬luck..still顯示未找到 – X10nD 2011-03-10 11:36:54
@Jean:哼哼..你如何得到_not found_消息它應該是'檔案存在'或'文件不存在' –
2011-03-10 11:46:35