当前位置: 首页>>代码示例>>PHP>>正文


PHP mkdir_r函数代码示例

本文整理汇总了PHP中mkdir_r函数的典型用法代码示例。如果您正苦于以下问题:PHP mkdir_r函数的具体用法?PHP mkdir_r怎么用?PHP mkdir_r使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mkdir_r函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plug_dev2prod

function plug_dev2prod($p, $o)
{
    $r = explore('progb', 'files', 1);
    $old = '_old/' . date('ymd') . '/';
    mkdir_r($old);
    $olb = '_old/' . date('ym') . '/';
    mkdir_r($olb);
    foreach ($r as $k => $v) {
        if ($v != '_trash.php') {
            $fa = 'progb/' . $v;
            $da = filemtime($fa);
            $sa = filesize($fa);
            $fb = 'prog/' . $v;
            $db = filemtime($fb);
            $sb = filesize($fb);
            if (date('d') == '01') {
                copy($fb, $olb . $v);
            }
            if ($sa != $sb or $da > $db) {
                copy($fb, $old . $v);
                copy($fa, $fb);
                $ret .= strdeb($v, '.') . ' ';
            }
        }
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:27,代码来源:dev2prod.php

示例2: run

 function run(&$xml_reponse, $p)
 {
     $cmdtocheck = array("send", "me", "notice");
     if (in_array($this->name, $cmdtocheck)) {
         $clientid = $p["clientid"];
         $param = $p["param"];
         $sender = $p["sender"];
         $recipient = $p["recipient"];
         $recipientid = $p["recipientid"];
         $c =& pfcGlobalConfig::Instance();
         $u =& pfcUserConfig::Instance();
         $logpath = $c->proxies_cfg[$this->proxyname]["path"] == "" ? $c->data_private_path . "/logs" : $c->proxies_cfg[$this->proxyname]["path"];
         $logpath .= "/" . $c->getId();
         if (!file_exists($logpath)) {
             @mkdir_r($logpath);
         }
         if (file_exists($logpath) && is_writable($logpath)) {
             $logfile = $logpath . "/chat.log";
             if (is_writable($logpath)) {
                 // @todo write logs in a cleaner structured language (xml, html ... ?)
                 $log = $recipient . "\t";
                 $log .= date("d/m/Y") . "\t";
                 $log .= date("H:i:s") . "\t";
                 $log .= $sender . "\t";
                 $log .= $param . "\n";
                 file_put_contents($logfile, $log, FILE_APPEND | LOCK_EX);
             }
         }
     }
     // forward the command to the next proxy or to the final command
     return $this->next->run($xml_reponse, $p);
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:32,代码来源:log.class.php

示例3: ifrim

function ifrim($f, $ret)
{
    $dr = 'users/public/ifram/';
    mkdir_r($dr);
    write_file($dr . mkday('', 'ydmHis') . '.jpg', $ret);
    return image($f);
}
开发者ID:philum,项目名称:cms,代码行数:7,代码来源:ifr.php

示例4: ifrim

function ifrim($f, $d)
{
    $dr = 'users/public/ifrm/';
    mkdir_r($dr);
    $fb = $dr . strrchr_b($f, '/');
    write_file($fb, $d);
    return image('/' . $fb);
}
开发者ID:philum,项目名称:cms,代码行数:8,代码来源:ifrm.php

示例5: mkdir_r

 function mkdir_r($path)
 {
     if (file_exists($path)) {
         return;
     }
     mkdir_r(dirname($path));
     mkdir($path);
 }
开发者ID:simplator,项目名称:medialib,代码行数:8,代码来源:Local.php

示例6: test_mkdir_r

 /**
  * Tests {@link mkdir_r()}
  */
 function test_mkdir_r()
 {
     if (!is_writable(TMPDIR)) {
         $this->my_skip_message('TMPDIR is not writable.');
         return;
     }
     $this->assertTrue(mkdir_r(TMPDIR . 'test/foo'));
     $this->assertTrue(is_dir(TMPDIR . 'test/foo'));
     $this->assertTrue(mkdir_r(TMPDIR . 'test/foo/bar/2'));
     $this->assertTrue(is_dir(TMPDIR . 'test/foo/bar/2'));
     $this->assertTrue(mkdir_r(TMPDIR . 'test//foo/bar///0'));
     $this->assertTrue(is_dir(TMPDIR . 'test//foo/bar///0'));
     // does not work (PHP does not allow it):
     // ini_set('open_basedir', TMPDIR.'test/bar');
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:18,代码来源:file.funcs.simpletest.php

示例7: prepareOutputDir

 static function prepareOutputDir($outdir)
 {
     if (!file_exists($outdir)) {
         echo " Directory " . $outdir . " doesn't exist, attempting to create it.\n";
         if (!mkdir_r($outdir, 0777)) {
             echo " Couldn't create directory.\n";
             return false;
         }
     }
     if (!chdir($outdir)) {
         echo "Couldn't change directory\n";
         return false;
     }
     return true;
 }
开发者ID:RasterCode,项目名称:Torque3D,代码行数:15,代码来源:FileUtil.php

示例8: funcb

function funcb($j, $k, $v, $io)
{
    $xt = substr($v ? $v : $j, -3);
    if (valid_ext($xt) or strpos($j, 'imgb/icons') !== false && $xt == '.gz') {
        if (substr($j, 0, 1) != '_' && substr($v, 0, 1) != '_' && substr($v, -8, 4) != '_sav' && strpos($j, '_notes/') === false or $v == '_admin.css' or $v == '_global.css' or $v == '_pictos.css' or $v == '_default.css') {
            $dir = '_public/' . $j;
            if (!is_dir($dir)) {
                mkdir_r($dir);
            }
            $f = $j;
            $fb = $dir;
            if ($v) {
                $f .= '/' . $v;
                $fb .= '/' . $v;
            }
            $t = copyif($f, $fb);
            echo $t . $fb . br();
        }
    }
}
开发者ID:philum,项目名称:cms,代码行数:20,代码来源:publish_site.php

示例9: strpos

 */
$compress = $compress && strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false;
if ($compress) {
    $gz_uri = "tmp/gzip/" . $src_uri . ".gz";
    if (file_exists($gz_uri)) {
        $src_last_modified = filemtime($src_uri);
        $dst_last_modified = filemtime($gz_uri);
        // The gzip version of the file exists, but it is older
        // than the source file. We need to recreate it...
        if ($src_last_modified > $dst_last_modified) {
            unlink($gz_uri);
        }
    }
    if (!file_exists($gz_uri)) {
        if (!file_exists("tmp/gzip/" . $uri_dir)) {
            mkdir_r("tmp/gzip/" . $uri_dir);
        }
        $error = false;
        if ($fp_out = gzopen($gz_uri, "wb")) {
            if ($fp_in = fopen($src_uri, "rb")) {
                while (!feof($fp_in)) {
                    gzwrite($fp_out, fread($fp_in, 1024 * 512));
                }
                fclose($fp_in);
            } else {
                $error = true;
            }
            gzclose($fp_out);
        } else {
            $error = true;
        }
开发者ID:469306621,项目名称:Languages,代码行数:31,代码来源:gz.php

示例10: runsql

 function runsql($noprint)
 {
     global $search, $auth, $idn, $id, $site_path, $im_array, $test, $i, $er, $lang, $_POST, $insertid, $r;
     if (!$this->checkPermission(1)) {
         return 0;
     }
     if ($this->act != "select") {
         $sql = $this->sql;
     } else {
         $sql = $this->action;
     }
     if ($sql) {
         if (!($numrows = $_POST['numrows'])) {
             $numrows = 1;
         }
         $tmpsql = $sql;
         for ($i = 0; $i < $numrows; $i++) {
             $sql = $tmpsql;
             $sql = str_replace("&lt;", "<", $sql);
             $sql = str_replace("&gt;", ">", $sql);
             $sqlar = explode("#", $sql);
             foreach ($sqlar as $sql) {
                 $j++;
                 $l = substr($sql, 0, 1);
                 if ($l == "^") {
                     eval($this->set_form_params(substr($sql, 1), $i));
                 } else {
                     if (($this->mode == 2 && ($this->attributes['field'] || $this->attributes['item']) || $this->mode == 1 && ($this->document->getElementsByTagName("fields") || $this->document->getElementsByTagName("header"))) && $this->name != "delete" && $this->name != "create" && $this->name != "drop") {
                         $sql = $this->set_form_params($sql, $i);
                     } else {
                         $sql = set_params($sql);
                     }
                     if ($er) {
                         break;
                     } else {
                         if (strstr($sql, "insert")) {
                             $c = 1;
                         }
                         //print $sql."<br>";
                         $sqlstr = str_replace(";", "", $sql);
                         $sqlstr = str_replace("#dot", ";", $sqlstr);
                         if ($res = runquery($sqlstr)) {
                             $str = set_params($this->success);
                         } else {
                             $er .= "<font color=black>Error<br> " . str_replace(";", "", $sql) . " <br></font>" . mysql_error();
                         }
                         if (substr($sql, 0, 6) == "select") {
                             $r = mysql_fetch_array($res);
                         }
                         if (!$er) {
                             if ($im_array) {
                                 foreach ($im_array as $v) {
                                     //print "<br>".$v['name']." ".$v['type'];
                                     $name = $this->table;
                                     if (!$name) {
                                         $name = "unfiled";
                                     }
                                     if ($auth->user == 455) {
                                         //print "$sql<br>";
                                     }
                                     //print $v['type'];
                                     $q = select("select @insertid");
                                     if ($q[0]) {
                                         $idn = $q[0];
                                     } else {
                                         $idn = $id;
                                     }
                                     if ($name && $v['image'] && $idn) {
                                         $path = $site_path . "images/" . $name . "/" . strtolower($v['name']) . "/";
                                         if (!file_exists($path)) {
                                             mkdir_r($path);
                                         }
                                         $file = fopen($path . $idn . ".jpg", "w");
                                         fputs($file, $v['image']);
                                     }
                                     if ($v['small'] && $name && $idn) {
                                         $path = $site_path . "images/" . $name . "/small/";
                                         if (!file_exists($path)) {
                                             mkdir_r($path);
                                         }
                                         $file = fopen($path . $idn . ".jpg", "w");
                                         fputs($file, $v['small']);
                                     }
                                     fclose($file);
                                 }
                             }
                             unset($im_array);
                         }
                     }
                 }
                 $r1 = select("select @error");
                 if ($r1[0]) {
                     if (strstr($r1[0], "#")) {
                         if (substr($r1[0], strlen($r1[0]) - 1, 1) == "#") {
                             $r1[0] = substr($r1[0], 0, strlen($r1[0]) - 1);
                         }
                         $ar = explode("#", $r1[0]);
                         foreach ($ar as $a) {
                             $er .= message($a) . "<br>";
                         }
//.........这里部分代码省略.........
开发者ID:dapfru,项目名称:gladiators,代码行数:101,代码来源:_cls_form.php

示例11: unpack_archive

/**
 * Unpack ZIP archive to destination directory
 *
 * @param string source file path
 * @param string destination directory path
 * @param boolean true if create destination directory
 * @param string Zip file name
 * @return boolean results
 */
function unpack_archive($src_file, $dest_dir, $mk_dest_dir = false, $src_file_name = '')
{
    if (!file_exists($dest_dir)) {
        // We can create directory
        if (!mkdir_r($dest_dir)) {
            echo '<p style="color:red">' . sprintf(T_('Unable to create &laquo;%s&raquo; directory to extract files from ZIP archive.'), $dest_dir) . '</p>';
            evo_flush();
            return false;
        }
    }
    if (function_exists('gzopen')) {
        // Unpack using 'zlib' extension and PclZip wrapper
        // Load PclZip class (PHP4):
        load_class('_ext/pclzip/pclzip.lib.php', 'PclZip');
        $PclZip = new PclZip($src_file);
        if ($PclZip->extract(PCLZIP_OPT_PATH, $dest_dir) == 0) {
            if (empty($src_file_name)) {
                // Set zip file name
                $src_file_name = $src_file;
            }
            echo '<p style="color:red">' . sprintf(T_('Unable to decompress &laquo;%s&raquo; ZIP archive.'), $src_file_name) . '<br />' . sprintf(T_('Error: %s'), $PclZip->errorInfo(true)) . '</p>';
            evo_flush();
            return false;
        }
    } else {
        debug_die('Unable to decompress the file because there is no \'zip\' or \'zlib\' extension installed in your PHP!');
    }
    return true;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:38,代码来源:_maintenance.funcs.php

示例12: fclose

    fclose($file);
    if (strstr($str, "message[" . $id . "]")) {
        $str = substr($str, 0, strpos($str, "\$message[" . $id)) . "\$message[" . $id . "] = '" . $_POST[$lang] . "';\r\n" . substr($str, strpos($str, "\$message", 1 + strpos($str, "\$message[" . $id)));
        $file = fopen($fname, "w");
        fputs($file, $str);
        fclose($file);
    }
}
if ($type == "engine/templates" && $step) {
    if ($id) {
        $_POST['TemplateID'] = $id;
    } else {
        $_POST['TemplateID'] = $insertid;
    }
    if (!file_exists($site_path . "templates/")) {
        mkdir_r($site_path . "templates/");
    }
    function recTemplate($id)
    {
        global $_POST;
        $q = select("select TemplateID,Header,Footer,ParentID from en_templates where TemplateID='{$id}'");
        if ($q[0]) {
            $_POST['Header'] = $q[Header] . $_POST['Header'];
            $_POST['Footer'] = $_POST['Footer'] . $q[Footer];
            if ($q[ParentID]) {
                recTemplate($q[ParentID]);
            }
        }
    }
    function makeTemplate($id)
    {
开发者ID:dapfru,项目名称:gladiators,代码行数:31,代码来源:index.php

示例13: generate

 public function generate($tpl, $platform, $base_dir)
 {
     // Alright, for each project scan and generate the file list.
     $projectFiles = array();
     $rootPhpBuildDir = getcwd();
     // Iterate over this project's outputs.
     foreach ($this->outputs as $outputName => $output) {
         $saved_includes = $this->includes;
         $saved_lib_dirs = $this->lib_dirs;
         //print_r( $output );
         // Supported platform?
         if (!$output->supportsPlatform($platform)) {
             //echo( "      # Skipping output: '$outputName'.\n" );
             continue;
         }
         // Get to the right working directory (first go back to root, then to relative)
         chdir($base_dir);
         //echo( "      - Changing CWD to " . $output->output_dir . "\n" );
         // echo("        (From: " . getcwd() . ")\n");
         if (!FileUtil::prepareOutputDir($output->output_dir)) {
             continue;
         }
         //echo( "      - Scanning directory for output  '.$outputName.'...\n" );
         if (!$this->generateFileList($projectFiles, $outputName, $output)) {
             echo "File list generation failed. Giving up on this project.\n";
             continue;
         }
         // Do any special work on the include/lib directories that we need
         $this->conditionDirectories($output, $projectFiles[$this->name]);
         $this->projectFileExt = $output->output_ext;
         if ($this->isCSProject()) {
             $this->projectFileExt = ".csproj";
         }
         // always csproj C# project under VS/MonoDevelop
         $outfile = $output->project_dir . $this->name . $this->projectFileExt;
         echo "      o Writing project file " . $outfile . "\n";
         $this->setTemplateParams($tpl, $output, $projectFiles[$this->name]);
         // To put a bandaid on the tools/player output dir problem
         // CodeReview: This should be in the template. -- BJG, 3/13/2007
         // Moved into templates -- neo
         // Write file
         $outdir = dirname($outfile);
         if (!file_exists($outdir)) {
             mkdir_r($outdir, 0777);
         }
         if ($hdl = fopen($outfile, 'w')) {
             if ($this->isApp()) {
                 $template = $output->template_app;
             } else {
                 if ($this->isLib()) {
                     $template = $output->template_lib;
                 } else {
                     if ($this->isSharedLib()) {
                         $template = $output->template_shared_lib;
                     } else {
                         if ($this->isSharedApp()) {
                             $template = $output->template_shared_app;
                         } else {
                             if ($this->isActiveX()) {
                                 $template = $output->template_activex;
                             } else {
                                 if ($this->isSafari()) {
                                     $template = $output->template_activex;
                                 } else {
                                     if ($this->isCSProject()) {
                                         $template = $output->template_csproj;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             fputs($hdl, $tpl->fetch($template));
             fclose($hdl);
         } else {
             trigger_error("Could not write output file: " . $output->outputFile, E_USER_ERROR);
         }
         if ($output->template_user) {
             $outfile = $output->project_dir . $this->name . $this->projectFileExt . '.' . getenv("COMPUTERNAME") . '.' . getenv("USERNAME") . '.user';
             if (!file_exists($outfile)) {
                 if ($hdl = fopen($outfile, 'w')) {
                     $template = $output->template_user;
                     fputs($hdl, $tpl->fetch($template));
                     fclose($hdl);
                 } else {
                     trigger_error("Could not write output file: " . $outfile, E_USER_ERROR);
                 }
             }
         }
         // Build the .filters file used by VS2010.
         if ($output->template_filter) {
             $filterData = new FilterData();
             array_walk($projectFiles[$this->name], array($filterData, 'callback'), '');
             $tpl->assign_by_ref('Folders', $filterData->folders);
             $tpl->assign_by_ref('SrcFiles', $filterData->srcFiles);
             $tpl->assign_by_ref('IncFiles', $filterData->incFiles);
             $tpl->assign_by_ref('OtherFiles', $filterData->otherFiles);
             $tpl->register_function('gen_uuid', 'gen_uuid');
             $outfile = $output->project_dir . $this->name . $this->projectFileExt . '.filters';
//.........这里部分代码省略.........
开发者ID:tainer32,项目名称:Torque3D,代码行数:101,代码来源:Project.php

示例14: CheckUploadedFiles

 function CheckUploadedFiles()
 {
     $upload_path = $this->config['upload_path'] . '/' . $this->GetPageTag();
     $max_upload_size = $this->config['max_upload_size'];
     if (!is_dir($upload_path)) {
         mkdir_r($upload_path);
     }
     // upload action
     $uploaded = $_FILES['file'];
     switch ($_FILES['file']['error']) {
         case 0:
             if ($_FILES["file"]["size"] > $max_upload_size) {
                 echo sprintf(ERROR_MAX_FILESIZE_EXCEEDED, bytesToHumanReadableUsage($max_upload_size));
                 unlink($uploaded['tmp_name']);
             } else {
                 $strippedname = str_replace("'", '', $uploaded['name']);
                 $strippedname = stripslashes($strippedname);
                 $destfile = $upload_path . '/' . $strippedname;
                 if (!file_exists($destfile)) {
                     if (!move_uploaded_file($uploaded['tmp_name'], $destfile)) {
                         echo ERROR_DURING_FILE_UPLOAD . "<br />\n";
                     }
                 } else {
                     echo sprintf(ERROR_FILE_EXISTS, $strippedname);
                 }
             }
             break;
         case 1:
         case 2:
             // File was too big.... as reported by the browser, respecting MAX_FILE_SIZE
             echo sprintf(ERROR_MAX_FILESIZE_EXCEEDED, bytesToHumanReadableUsage($max_upload_size));
             break;
         case 3:
             echo ERROR_DURING_FILE_UPLOAD;
             break;
         case 4:
             echo NO_FILE_UPLOADED;
             break;
     }
 }
开发者ID:freebasic,项目名称:fbwikka,代码行数:40,代码来源:Wakka.class.php

示例15: incMeta

 function incMeta($group, $subgroup, $leaf)
 {
     $c =& pfcGlobalConfig::Instance();
     // create directories
     $dir_base = $c->container_cfg_server_dir;
     $dir = $dir_base . '/' . $group . '/' . $subgroup;
     if (!is_dir($dir)) {
         mkdir_r($dir);
     }
     // create or replace metadata file
     $leaffilename = $dir . "/" . $leaf;
     // create return array
     $ret = array();
     $ret["timestamp"] = array();
     $ret["value"] = array();
     // read and increment data from metadata file
     clearstatcache();
     if (file_exists($leaffilename)) {
         $fh = fopen($leaffilename, 'r+');
         for ($i = 0; $i < 10; $i++) {
             if (flock($fh, LOCK_EX)) {
                 $leafvalue = chop(fread($fh, filesize($leaffilename)));
                 $leafvalue++;
                 rewind($fh);
                 fwrite($fh, $leafvalue);
                 fflush($fh);
                 ftruncate($fh, ftell($fh));
                 flock($fh, LOCK_UN);
                 break;
             }
             // If flock is working properly, this will never be reached
             $delay = rand(0, pow(2, $i + 1) - 1) * 5000;
             // Exponential backoff
             usleep($delay);
         }
         fclose($fh);
     } else {
         $leafvalue = "1";
         file_put_contents($leaffilename, $leafvalue, LOCK_EX);
     }
     $ret["value"][] = $leafvalue;
     $ret["timestamp"][] = filemtime($leaffilename);
     return $ret;
 }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:44,代码来源:file.class.php


注:本文中的mkdir_r函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。