doulandai0641 2010-09-20 10:53
浏览 29
已采纳

Scandir Never Return

I am developing using a Windows 7 machine with the local server being UniServer.

I have some PHP code to include all php files in a directory.

# Include all library classes.
$library_files = scandir(LIBRARY_PATH);
foreach ($library_files as $file) {
    $path_parts = pathinfo($file);
    if ($path_parts['extension'] == 'php') {
        require(LIBRARY_PATH . DIRECTORY_SEPARATOR . $file);
    }
}

Calling the scandir function causes the script to never end. I am not sure if this is a problem with the permissions of the folder. I am able to include files from within the folder.

What is going wrong here? Thankyou.

Edit: LIBRARY_PATH equals E:\Tools\UniServer\www\LIBRARY

Edit: Apparently it is working now. I'm confused, I haven't changed anything at all. I think I might need to reinstall PHP. Thanks for helping

  • 写回答

1条回答 默认 最新

  • dsozqcx9668 2010-09-20 11:25
    关注

    Calling the scandir function causes the script to never end

    A bit vague.

    Have you tried running the script from the CLI, writing to stdout after scandir and flushing the output buffer before entering the loop?

    What happens if you try to DIR E:\Tools\UniServer\www\LIBRARY at the command prompt?

    What happens when you try DIR E:\Tools\UniServer\www\LIBRARY within a PHP script?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?