开发者

Scandir Never Returns

开发者 https://www.devze.com 2023-01-16 16:28 出处:网络
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.

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: Apparentl开发者_StackOverflow社区y 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


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消