dongxiaoxing3058 2014-07-05 13:19
浏览 1403

PHP is_dir总是返回false

I am trying to use the is_dir function, but it always returns false even if the directory does indeed exist. I am a very new Linux user(xubuntu), and i read in similar questions here that the issue is probably the directory permission. I have tried using:

sudo chmod -R folder_path

But it's still not working. How can i fix it? Thanks.

EDIT: I forgot to mention that i am working in codeigniter. I have tried to use file_exists(which like is_dir doesn't work in my codeigniter project) on 2 separate files, and it worked. Is it possible that the problem is because i am using codeigniter?

  • 写回答

2条回答 默认 最新

  • dongtong2021 2014-07-05 13:21
    关注

    You forgot about permissions, use:

    sudo chmod -R 775 folder_path
    

    Also remember that is_dir() function caching the result, from documentation:

    Note: The results of this function are cached. See clearstatcache() for more details.
    

    Maybe this is Your problem?

    Or Try to use absolute path instead of relative one.

    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建