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


PHP Dir::create方法代码示例

本文整理汇总了PHP中Dir::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::create方法的具体用法?PHP Dir::create怎么用?PHP Dir::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dir的用法示例。


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

示例1: make

 public static function make($inputData = array())
 {
     $loadData = self::get();
     // print_r($loadData);die();
     $url = $loadData['data']['file'];
     $sourcePath = '';
     if (!is_dir(ROOT_PATH . 'uploads/tmp/update/')) {
         Dir::create(ROOT_PATH . 'uploads/tmp/update/');
     }
     File::downloadModule($url, 'uploads/tmp/update/', 'yes');
     if (preg_match('/github\\.com/i', $url)) {
         $sourcePath = ROOT_PATH . 'uploads/tmp/update/noblessecms-master/';
     } else {
         $sourcePath = ROOT_PATH . 'uploads/tmp/update/noblessecms/';
     }
     $descPath = ROOT_PATH . 'uploads/tmp/test/';
     if (is_dir($sourcePath)) {
         unlink($sourcePath . '.htaccess');
         unlink($sourcePath . 'config.php');
         unlink($sourcePath . 'autoload.php');
         unlink($sourcePath . 'routes.php');
         unlink($sourcePath . 'README.md');
         if (file_exists($sourcePath . 'install/update.sql')) {
             Database::import($sourcePath . 'install/db.sql');
             Database::import($sourcePath . 'install/update.sql');
         }
         Dir::remove($sourcePath . 'install');
         Dir::remove($sourcePath . 'contents');
         Dir::remove($sourcePath . 'application/caches');
     }
     // File::fullCopy($sourcePath,ROOT_PATH.'uploads/tmp/test/');
     File::fullCopy($sourcePath, ROOT_PATH);
     Dir::remove($sourcePath);
     // Dir::remove($descPath);
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:35,代码来源:Update.php

示例2: __construct

 public function __construct()
 {
     //smarty配置
     if (!is_null(self::$smarty)) {
         return;
     }
     $smarty = new Smarty();
     $smarty->template_dir = ROOT_PATH . APP_PATH . '/' . MODULE . APP_TPL_PATH . '/' . CONTROLLER . '/';
     //模板目录
     $smarty->compile_dir = APP_TEMP_PATH . '/Compile/' . MODULE . '/';
     //模板编译目录
     $smarty->cache_dir = APP_TEMP_PATH . '/Cache/' . MODULE . '/';
     //模板缓存目录
     if (!file_exists($smarty->cache_dir)) {
         Dir::create($smarty->cache_dir);
     }
     $smarty->left_delimiter = C('LEFT_DELIMITER');
     //左边界符号
     $smarty->right_delimiter = C('RIGHT_DELIMITER');
     //右边界符
     $smarty->caching = C('CACHE_ON');
     //缓存开启
     $smarty->cache_lifetime = C('CACHE_TIME');
     //缓存时间
     // $smarty->allow_php_templates = true;
     self::$smarty = $smarty;
 }
开发者ID:sujinw,项目名称:webPHP,代码行数:27,代码来源:SmartyView.class.php

示例3: run

 public function run()
 {
     $this->content = file_get_contents($this->view->tplFile);
     //获得模板内容
     $this->loadParseTags();
     //加载标签库  及解析标签
     $this->replaceGlobalFunc();
     //解析全局函数{U:'index'}
     $this->compile();
     //解析全局内容
     $this->parseTokey();
     //解析POST令牌Token
     $this->replaceConst();
     //将所有常量替换   如把__APP__进行替换
     $this->replaceLiteral();
     //将Literal内容替换
     $this->content = '<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?>' . $this->content;
     if (!is_dir(APP_COMPILE_PATH)) {
         Dir::create(APP_COMPILE_PATH);
         copy(HDPHP_TPL_PATH . 'index.html', APP_COMPILE_PATH . 'index.html');
     }
     //创建编译目录
     is_dir(dirname($this->view->compileFile)) or Dir::create(dirname($this->view->compileFile));
     file_put_contents($this->view->compileFile, $this->content);
     //创建安全文件
     $safeFile = dirname($this->view->compileFile) . "/index.html";
     is_file($safeFile) or Dir::safeFile(dirname($safeFile));
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:28,代码来源:ViewCompile.class.php

示例4: dir

 public function dir($dir)
 {
     $this->dir = $dir;
     if (!Dir::create($this->dir) || !is_writable($this->dir)) {
         throw new Exception("缓存目录创建失败或目录不可写");
     }
     return $this;
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:8,代码来源:File.php

示例5: setSavePath

 /**
  * 设置SESSION存储路径
  * @param type $path
  */
 static function setSavePath($path)
 {
     self::start();
     if (!is_dir($path)) {
         Dir::create($path);
     }
     session_save_path($path);
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:12,代码来源:Session.class.php

示例6: setSavePath

 private function setSavePath($path)
 {
     $path = $path ? $path : C('UPLOAD_PATH') . '/content/' . date('Y/m/d');
     if (!is_dir($path)) {
         Dir::create($path);
     }
     return trim($path, '/');
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:8,代码来源:Attachment.class.php

示例7: save

 public static function save($cacheName, $text)
 {
     $cacheName = Sanitize::variable($cacheName, ".-");
     $filename = "/" . ltrim($cacheName, "/") . '.html';
     // Make sure the directory exists
     Dir::create(APP_PATH . self::$cacheDirectory . dirname($filename));
     // Write the new file
     return File::write(APP_PATH . self::$cacheDirectory . $filename, $text);
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:9,代码来源:Cache_File.php

示例8: save

 /**
  * 储存内容
  * @param string $fileName 文件名
  * @param string $content 数据
  */
 public function save($fileName, $content)
 {
     $dir = dirname($fileName);
     Dir::create($dir);
     if (file_put_contents($fileName, $content) === false) {
         halt("创建文件{$fileName}失败");
     }
     $this->contents[$fileName] = $content;
     return true;
 }
开发者ID:jyht,项目名称:v5,代码行数:15,代码来源:FileStorage.class.php

示例9: create

 public static function create($filePath = '', $fileData = '', $writeMode = 'w')
 {
     $path = dirname($filePath);
     if (!is_dir($path)) {
         Dir::create($path);
     }
     $fp = fopen($filePath, $writeMode);
     fwrite($fp, $fileData);
     fclose($fp);
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:10,代码来源:File.php

示例10: sendMessage

 public function sendMessage($sdata, $data)
 {
     $res = $this->add($sdata);
     //添加到发件人表
     if ($res) {
         $data['mid'] = $res;
         $fields = "";
         $values = "";
         foreach ($data as $k => $v) {
             $fields .= '`' . $this->_safe_str($k) . '`,';
             $values .= "'" . $this->_safe_str($v) . "',";
         }
         $fields = trim($fields, ',');
         $values = trim($values, ',');
         $sql = "INSERT INTO " . C('DB_PREFIX') . $this->rectable . " (" . $fields . ") VALUES (" . $values . ")";
         $result = $this->exe($sql);
         if ($result) {
             $path = APP_CACHE_PATH . '/DataBase_id';
             $Dir = new Dir();
             if (!is_dir($path)) {
                 $file = $Dir->create($path) ? $path . '/' . $this->table . '.txt' : NULL;
                 $recfile = $Dir->create($path) ? $path . '/' . C('DB_PREFIX') . $this->rectable . '.txt' : NULL;
             } else {
                 $file = $path . '/' . $this->table . '.txt';
                 $recfile = $path . '/' . C('DB_PREFIX') . $this->rectable . '.txt';
             }
             if (!is_null($file) || !is_null($recfile)) {
                 if (file_put_contents($file, $res) || file_put_contents($recfile, $result)) {
                     return true;
                 } else {
                     return false;
                 }
             } else {
                 return false;
             }
         }
     }
 }
开发者ID:sujinw,项目名称:webPHP,代码行数:38,代码来源:MessageModel.class.php

示例11: compile

 /**
  * 根据模板文件生成编译文件
  *
  * @param $file
  *
  * @return string
  */
 public function compile($file)
 {
     $file = $this->template($file);
     $compileFile = ROOT_PATH . '/storage/view/' . preg_replace('/[^\\w]/', '_', $file) . '_' . substr(md5($file), 0, 5) . '.php';
     $status = c('app.debug') || !is_file($compileFile) || filemtime($file) > filemtime($compileFile);
     if ($status) {
         Dir::create(dirname($compileFile));
         //执行文件编译
         $compile = new Compile($this);
         $content = $compile->run($file);
         file_put_contents($compileFile, $content);
     }
     return $compileFile;
 }
开发者ID:houdunwang,项目名称:hdphp,代码行数:21,代码来源:View.php

示例12: write

 public static function write($filepath, $text, $overwrite = true)
 {
     // Check if the file already exists, and react accordingly
     if (self::exists($filepath) && $overwrite == false) {
         return false;
     }
     // Make sure the directories leading to the file exist
     $pos = strrpos($filepath, "/");
     $fileDirectory = substr($filepath, 0, $pos);
     if (!is_dir($fileDirectory)) {
         Dir::create($fileDirectory);
     }
     // Write the content to the file
     return (bool) file_put_contents($filepath, $text);
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:15,代码来源:File.php

示例13: run

 public function run()
 {
     $this->content = file_get_contents($this->view->tplFile); //获得模板内容
     $this->loadParseTags(); //加载标签库  及解析标签
     $this->replaceGlobalFunc(); //解析全局函数{U:'index'}
     $this->compile(); //解析全局内容
     $this->parseTokey(); //解析POST令牌Token
     $this->replaceConst(); //将所有常量替换   如把__APP__进行替换
     $this->content = '<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_WARNING",false);?>' . $this->content;
     if (!is_dir(COMPILE_PATH)) {
         Dir::create(COMPILE_PATH);
         copy(HDPHP_TPL_PATH . 'index.html', COMPILE_PATH . 'index.html');
     }
     file_put_contents($this->view->compileFile, $this->content);
 }
开发者ID:happyun,项目名称:tuan,代码行数:15,代码来源:Compile.class.php

示例14: addLever

 public function addLever($data)
 {
     $res = $this->add($data);
     if ($res) {
         $path = APP_CACHE_PATH . '/DataBase_id';
         $dir = new Dir();
         if (!is_dir($path)) {
             $dir->create($path);
         }
         if (file_put_contents($path . '/' . $this->table . '.txt', $res)) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:sujinw,项目名称:webPHP,代码行数:16,代码来源:UserLeverModel.class.php

示例15: addCate

 public function addCate($data)
 {
     $res = $this->add($data);
     if ($res) {
         $path = APP_CACHE_PATH . '/DataBase_id';
         if (!is_dir($path)) {
             Dir::create($path);
         }
         $file = $path . '/' . $this->table . '.txt';
         if (file_put_contents($file, $res)) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:sujinw,项目名称:webPHP,代码行数:16,代码来源:ArticleCateModel.class.php


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