php中文网
/*** 建立url或者路径path的文件夹,并将url里的文件夹设置为可写, 如果不指定路径则在当前目录建立文件夹,否则在设置路径里建立文件夹。 $url : 可为任意目录形式url,如'1/2/3/4/'、'1/2/3/4'、'http://www.5jiuai.com/1/2/3/43/4/' $path : 可为任意形式的path,如'd:/test'、'd:\test' 返回 : 路径目录 例子: $url = 'http://www.5jiuai.com/1/2/3/43/4/'; $path = 'd:/test'; echo create_folder($url,'d:/test'); */ function create_folder($url,$path=''){ $path_str = !empty($path) ? $path : realpath(dirname(__FILE__)); //当 $c_path==''时,取当前目录 $folder_path_str = preg_match('/\\\/i',$path_str) ? preg_replace('/\\\/i','/',$path_str) : $path_str; //将路径里的'\'全部转为'/' $folder_path_arr = preg_match('/\//i',$folder_path_str) ? explode('/',$folder_path_str) : array(); //将路径分割为数组 $no_http_url = preg_match('/http:\/\//i',$url) ? preg_replace('/http:\/\//i','',$url) : $url; //去除url中的'http://' 字符 $no_http_url = preg_match('/\\\/i',$no_http_url) ? preg_replace('/\\\/i','/',$no_http_url) : $no_http_url; //将url里的'\'全部转为'/' $folder_url_arr = preg_match('/\//i',$no_http_url) ? explode('/',$no_http_url) : array(); //将url分割为数组 $path_arr = @array_merge($folder_path_arr,$folder_url_arr); //合并数组 $path_way = ''; foreach($path_arr as $key => $val){ if(empty($val)) continue; //如果$val为空值,则跳转到下一步 $path_way .= $val.'/'; if(is_dir($path_way)) continue; //如果目录已经存在,则跳转到下一步 @mkdir($path_way); if(in_array($val,$folder_url_arr)) @chmod($path_way,0777); //将url里的目录设置为可写 } return $path_way; }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools