创建多级目录
来源:一方有 责任编辑:admin 发表时间:2013-07-01 16:36 点击:次
	   
	写出一个能创建多级目录的PHP函数
- <?php
 - /*
 - 21、写出一个能创建多级目录的PHP函数。
 - *系统环境:windows/linux
 - *编译环境:php5/php4
 - *输入参数:存放在in.txt,多个参数时空格分隔
 - 参数1是一个路径,用\或者/分隔
 - 例如:www\b\c\d\e d:\www\b\c\d\e /var/www/html var/../b/c
 - 输出:out.txt
 - */
 - $params=getParams(1);
 - $dirParh=trim($params[0]);
 - mkdirP($dirParh);
 - function mkdirP($dirParh)
 - {
 - $dirParh=str_replace("\\", "/", $dirParh);
 - $paths=split("/",$dirParh);
 - $nowPath="";
 - if(substr($dirParh, 0,1)=="/")
 - {
 - $nowPath="/";
 - }
 - foreach($paths as $path)
 - {
 - if($path=="")
 - {
 - continue;
 - }
 - $nowPath.=$path;
 相关新闻>>
- 发表评论
 - 
				
 
- 最新评论 进入详细评论页>>
 





![smarty局部缓存技术[源码分析]](/uploads/allimg/130827/11214T939-0-lp.jpg)