當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。