php named()设备或资源繁忙 [英] php rename() Device or resource busy

查看:64
本文介绍了php named()设备或资源繁忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有给出以下错误的代码:

I have code that gives the following error:

警告:

[function.rename]:设备或资源忙于

[function.rename]: Device or resource busy in

if ($handle = opendir($temp_images)) {

        /* This is the correct way to loop over the directory. */
        while (false !== ($file = readdir($handle))) {
             if ($file == $file) {
             }
             $path = ''; 
             $dir_handle = opendir($path);
             chdir($path);
             $oldfile = $path.$file ;
             $newfile = $path.preg_replace('/[\\&\\%\\$\\ ]+/', '-', $file); // replace &%$ with a - 

             if(FALSE == rename($oldfile, $newfile)) 
             {

             }

        }

       closedir($handle);
}

有什么问题,我该如何解决?

What's the problem and how do I fix it?

推荐答案

尝试排除'.''..'.

if($file == '.' || $file == '..') {
    continue;
}

对我有用.希望它将为您工作.谢谢

It works for me. Hopefully, it will work for you. Thanks

这篇关于php named()设备或资源繁忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆