php 判断文件和路径是否存在

    $url = $this->film_model . $user['shop_id'] . "/code_img/";
         //判断是否存在
    if(!$this->isDirFile($url)){
           mkdir ($url,0777,true);
    }



        //判断文件或者目录是否存在
    protected function isDirFile($path,$isfile = false){
        if($isfile){
            return file_exists($path) ? true : false;
        }else{
            return is_dir($path) ? true : false;
        }
    }

 

posted @ 2020-07-10 18:06  野香蕉  阅读(2085)  评论(0编辑  收藏  举报