简体   繁体   English

Scandir无法打开目录

[英]Scandir fails to open directory

$contentdirectory = '/dead-wave/dead-wave_content'; 

      $contentlaunch = scandir($contentdirectory);

that's what I'm using to create an array from which I echo it's values using a for each statement. 这就是我用来创建一个数组,我用它来为每个语句回显它的值。 this works perfectly on my dedicated server, but once hosted on godaddy servers returns an error message 'failed to open dir: No such file or directory in...' now the directory path is certainly correct the actual problem is unknown to me. 这在我的专用服务器上运行得很好,但是一旦托管在godaddy服务器上,就会返回错误消息“无法打开目录:没有这样的文件或目录......”现在目录路径肯定是正确的,我不知道实际问题。 Any Thoughts? 有什么想法吗?

Are you sure the path is correct? 你确定路径是正确的吗? If the path is a subdirectory of your current directory, you should use 'dead-wave/dead-wave_content' instead of '/dead-wave/dead-wave_content'. 如果路径是当前目录的子目录,则应使用'dead-wave / dead-wave_content'而不是'/ dead-wave / dead-wave_content'。

are you sure the path is correct? 你确定路径是正确的吗? on a hosting you are usually rooted to a different directory (like /home/user1 ). 在托管上,您通常根植于不同的目录(例如/home/user1 )。

So the Path from above would be /home/user1/dead-wave/dead-wave_content/ 所以上面的路径是/home/user1/dead-wave/dead-wave_content/

you can do a 你可以做一个

exec('pwd',$return);
print_r($return);

to find out where you actually are. 找出你实际在哪里。

I'm not sure this is the same problem you're having but sometimes I can't use any file i/o functions when I'm running unit tests on top of Zend Server via Zend Studio even though they worked on Apache . 我不确定这是你遇到的同样的问题,但有时当我通过Zend Studio在Zend Server上运行单元测试时,我不能使用任何文件i / o函数,即使它们在Apache上工作

I think you need to rewrite you paths somehow making them relative to the server web directory constant. 我认为你需要以某种方式重写你的路径使它们相对于服务器web目录常量。 I'm not sure what that is but I'm sure there is one. 我不确定那是什么,但我确定有一个。

EDIT Oh! 编辑哦! I don't think Apache recognizes '/toplevel/secondlevel' path writing style. 我不认为 Apache识别'/ toplevel / secondlevel'路径写作风格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM