is_dir 检查不起作用

发布于 2024-07-29 19:23:39 字数 893 浏览 2 评论 0原文

我在使用/理解 is_dir 时遇到一些问题。 (是的,我已经阅读了 PHP 文档)。

我有一个如下的 baseDIR:

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\'

以下代码是 TRUE,因此输出文本:

if (is_dir($gallery->baseDIR)) 
  echo 'DIR exists';

现在我需要检查是否有一个名为“f”的目录(是的,只有一个字符)。 但以下代码返回 false:

if (is_dir($gallery->baseDIR.'f\\')) 
  echo 'DIR exists';

当目录存在时,为什么不返回 true?

我正在 Win XP 上进行开发,但我的 ISP 产品服务器是 Unix。

更新:
回显 $gallery->baseDIR.'f\' 给出以下输出:

I:\Development\wamp\www\mySite\wp-content\uploads\f\

更新 2:
我不得不承认,经过 12 个小时的工作,我已经很累了,而且现在已经过了午夜了。 我犯了一个简单的愚蠢错误。 我忘记将图像文件夹添加到基本目录中......

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\slgallery\'

I'm having some problems using / understanding is_dir. (Yes, I have read the PHP doc).

I have a baseDIR as following:

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\'

The following code is TRUE and therefore outputs the text:

if (is_dir($gallery->baseDIR)) 
  echo 'DIR exists';

Now I need to check if there is a directory called 'f' (yes, just one character). But the following code returns false:

if (is_dir($gallery->baseDIR.'f\\')) 
  echo 'DIR exists';

Why is this not returning true, when the dir exists?

I'm developing on Win XP, but my ISP prod server is Unix.

Update:
Echoing $gallery->baseDIR.'f\' gives me the following output:

I:\Development\wamp\www\mySite\wp-content\uploads\f\

Update 2:
I have to admit that I'm tired after 12h of work and it's way past midnight. Simple STUPID mistake from me. I had forgoten to add he image folder to the base dir....

$baseDIR = 'I:\Development\wamp\www\mySite\wp-content\uploads\slgallery\'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

翻了热茶 2024-08-05 19:23:39

这可能是 open_basedir 限制。 通过执行 phpinfo() 检查设置,此设置通常在启用 safe_mode 时出现。

It could be an open_basedir restriction. Check the setting by executing phpinfo(), this setting is usually present when safe_mode is enabled.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文