// 安全文件路径,$fileName:完成文件路径 function securityFilePath($fileName,$read_write = '0777'){ $path = dirname($fileName); if(!file_exists($path)){// 判断路径是否存在,如果不存在则mkdir创建,并写入权限 mkdir ($path,$read_write,true); } }