楼主可以搜索一下,很多的:
如:
http://www.dayanmei.com/blog.php/ID_809.htm

解决方案 »

  1.   

    mkdir('a/b/c');
    一次建立a,b,c三个目录,有成的吗?
    使用绝对路径有成功的吗?
      

  2.   

    mkdir只能建立当前的目录,多个目录需要自己写函数,楼主可以根据:
    读取目录列表-〉判断是否是目录-〉如果是文件,跳过
                                 -〉如果是目录,递归一次,再判断。
      

  3.   

    楼主都 猩猩 了...
    怎么都不去看手册~全部都有写啊 XDhttp://cn.php.net/mkdir
      

  4.   

    Linux下命令行中是可以通过mkdir -p /a/b/c来一次创建所有目录(如果不存在的话)的,所以我猜也可以。然后我去看PHP的手册,查到mkdir的说明:bool mkdir  ( string $pathname  [, int $mode=0777  [, bool $recursive=false  [, resource $context  ]]] )这个recursive声明引起了我的注意,继续看详细的说明,但是没有很明确的提示。不过LZ不妨一试。不过在Windows下可能不行。
      

  5.   

    function _mkdir($dir)
    {
    $arrDir = explode('/', $dir);
    $curDir = ".";
    if(is_array($arrDir))
    {
    foreach($arrDir as $key=>$value)
    {
    $curDir = $curDir . "/" .$value;
    if(is_dir($curDir))
    {
    continue;
    }
    else 
    {
    mkdir($curDir);
    }
    }
    }
    return;
    }linux下用 system("mkdir -p /a/b/c");吧,这个更实用一些.
      

  6.   

    天阿。居然几乎没人知道mkdir有$recursive这个参数,我来到了火星吗?
      

  7.   

    呵呵,学习了,我都不知道有这个参数哦,原来那么简单的。回12楼的,我在WINDOWS测试过了,PHP版本5.2.8测试通过。
      

  8.   

    那个参数只支持PHP5.0.0以上版本的,不支持PHP4。
      

  9.   

    谢谢各位老兄了,手册不太详另外,英文差了点,recursive中文是递归的意思,当时没认清,马虎过了
    害得自已写递归函数!见过别人说可以的,看来手册还得好好看!
      

  10.   

    递归吧
    function createFolder($path){
    if (!file_exists($path)){
    createFolder(dirname($path));
    mkdir($path, 0711);
    }
    }这个网上写的,还不错
      

  11.   

    建立多层目录的例子:目录树:
    [code=BatchFile]0 ------ 0
    1          1
    2          2 -------- 0
    3          3             1
    4          ...           2
    5                        3
    6                        ...
    7
    [....]
    e
    f[/code]代码:for ($a=0;$a<=15;$a++) {
       
        mkdir(dechex($a),0755);    for ($b=0;$b<=15;$b++) {        mkdir(dechex($a).'/'.dechex($b),0755);        for ($c=0;$c<=15;$c++) {            mkdir(dechex($a).'/'.dechex($b).'/'.dechex($c),0755);        }    }}
      

  12.   

    since PHP 5, setting the recursive flag (which currently has no notes in the manual entry) will allow you to create nested directories in the same way as Windows / Linux mkdir -p, so long as the webserver has permissions to write in the root directory of the path specified
    eg:<?php
      mkdir ("./newdir1/newdir2/newdir3/", 0755, true);  // Returns TRUE if you have permission to write to the current directory 
      //   and creates nested directories with permissionsrwxr-xr-x
    ?>是可以的,不过版本要新的
      

  13.   


    $path1="F:/wenjian/wenjian/wenjian"; 
    function createFolder($path) //自定义的创建文件夹的函数        
    {
       if (!file_exists($path))         //如果文件夹不存在 
        {
         createFolder(dirname($path));    //递归创建  //取得最后一个文件夹的全路径返回开始的地方
         mkdir($path, 0777);//创建并写文件
        }
    }
    createFolder($path1);这样就建立了多层目录很方便啊
      

  14.   

    mkdir(吃/喝/玩/乐,true)
    我记得可以这样用了???