douque9982 2017-07-24 20:39
浏览 34
已采纳

如果文件存在,则找不到以.php结尾的文件[复制]

This question already has an answer here:

I need to check if a file exist but the system cannot find the file, it may be because the code is ending the $var with .php I dont know. Here is the code

  $thefile=$_POST['files'];
    if (file_exists('/infrastructure/datacenter/'.$thefile.'.php'))
{include('infrastructure/datacenter/'.$thefile.'.php');}

Any idea why the file cannot be found? Because the file really exist

the file name in the test is 2001.php and it does exist but php says it does not exist

SOLVED

There was a missing / in the include second path

</div>
  • 写回答

2条回答 默认 最新

  • dongshan9338 2017-07-24 20:41
    关注

    You have the if statement checking an absolute path, while your include statement is relative.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 springboot和springcloud版本问题
  • ¥15 ps2手柄控制树莓派小车
  • ¥30 C#:vsto powerpoint的外接程序
  • ¥30 stata将do文件代码转化为ado文件
  • ¥15 两个同维数组相比,不同位置、出现重复比无意义,而不同位置、不出现重复比,则有意义。把有意义的两个数组放入新的集合MK中。
  • ¥15 可以远程电脑安装nvm
  • ¥15 写一个可直接调用的函数,将32位有符号数转成另一个无符号的数
  • ¥15 CMAKE+VS2019+QT5.15.2组合进行二次编译
  • ¥15 nginx 配置静态html访问 ,后台登录时页面始终被重定向到登录页,无法访问到后台的静态html页
  • ¥20 自动登录的j2ee程序编译