关于网友提出的“php的realpath,file_exists为什么都返回空字符”问题疑问,本网通过在网上对“php的realpath,file_exists为什么都返回空字符”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:php的realpath,file_exists为什么都返回空字符
描述: 不是搞php的,结果挨拉去弄php,下载了个php程序,环境也配置好了
系统环境:window2003+IIS6+FastCGI+PHP5.3.4
网站根目录下 index.php里面有这句
if(!file_exists('install/lock')){
echo '-'.realpath('install/lock').'-'.'-
';
echo '-'.realpath('index.php').'-
';
// header('Location:install/index.php');
exit();
}
客户端就返回这个
--
--
但是在install目录下index.php文件有下面的语句,确可以执行。。也能获取都路径,上级目录的也没问题。。
if (file_exists('lock')){
@header("Content-type: text/html; charset=UTF-8");
echo '-'.realpath('lock').'-
';
echo '-'.realpath('../index.php').'-
';
echo "系统已经安装过了,如果要重新安装,那么请删除install目录下的lock文件";
exit;
}
-D:\phpwebs\wesambonew20151206\install\lock-
-D:\phpwebs\wesambonew20151206\index.php-
系统已经安装过了,如果要重新安装,那么请删除install目录下的lock文件
什么问题了,哪里没配置好?
解决方案1: 你把 header('Location:install/index.php'); 都注释掉了,当然只能输出 --
--
if(!file_exists('install/lock')){ //如果 install/lock 不存在,则进入分支
echo '-'.realpath('install/lock').'-'.'-
'; //打印一个不存在的文件全名,自然是空的空
echo '-'.realpath('index.php').'-
'; //这个输出空的不对的,应该是你写错了
// header('Location:install/index.php'); //这个注释掉了,自然没有动作
exit();
}
以上介绍了“php的realpath,file_exists为什么都返回空字符”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1050830.html