代码行为奇怪 - 特别是mkdir()函数

时间:2014-04-29 11:48:58

标签: php warnings mkdir

请看一下代码,它每次都会发出警告。为什么? Warning: mkdir() [function.mkdir]: File exists in D:\wamp\www\Mubin\crawlers\includes\functions.php on line 80

public function save_image($folder, $url){
        if (!is_dir($folder)) {
            mkdir(IMG_PATH.$folder, 0777, true);
        }
        // function will take the url of the image and also the name of the folder where the image will have to be stored and then will get that image
        //from there and will put this into specified directory.
        $path = IMG_PATH."$folder/".basename($url);
        $contents = file_get_contents($url);
        if(file_put_contents($path, $contents)){
            return 1;
        }
        else{
            return 0;
        }
    }

0 个答案:

没有答案