file_exists 函数 windows 系统跟linux系统有区别吗?
我今天在弄东西的时候使用 file_exists 验证文件是否存在,但结果有点失望,file_exists总是返回 false我是windows xp的系统代码:<?php
$file = '/test.htm';
echo file_exists($file) ? '存在' : '不存在';
?>这个总是返回 false 但文件其实是存在的。<?php
$file = 'E:/php/qq.htm';
echo file_exists($file) ? '存在' : '不存在';
?>这个就返回true了 file_exists 是不是必须从盘符开始呢?
我今天在弄东西的时候使用 file_exists 验证文件是否存在,但结果有点失望,file_exists总是返回 false我是windows xp的系统代码:<?php
$file = '/test.htm';
echo file_exists($file) ? '存在' : '不存在';
?>这个总是返回 false 但文件其实是存在的。<?php
$file = 'E:/php/qq.htm';
echo file_exists($file) ? '存在' : '不存在';
?>这个就返回true了 file_exists 是不是必须从盘符开始呢?
------------------------------------------------
http://topic.csdn.net/u/20100331/21/0ac266ec-1910-483b-9f91-4d781a773b96.html
在linux下 /表示根目录最好写成./test.html, 这个相对路径的写法,在windows和linux下都通用.