當前位置: 首頁>>代碼示例>>PHP>>正文


PHP file::copydir方法代碼示例

本文整理匯總了PHP中file::copydir方法的典型用法代碼示例。如果您正苦於以下問題:PHP file::copydir方法的具體用法?PHP file::copydir怎麽用?PHP file::copydir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在file的用法示例。


在下文中一共展示了file::copydir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: copydir

 function copydir($srcdir, $dstdir)
 {
     if (!is_dir($dstdir)) {
         mkdir($dstdir);
     }
     if ($curdir = opendir($srcdir)) {
         while ($file = readdir($curdir)) {
             if ($file != '.' && $file != '..') {
                 $srcfile = $srcdir . '/' . $file;
                 $dstfile = $dstdir . '/' . $file;
                 if (is_file($srcfile)) {
                     copy($srcfile, $dstfile);
                 } else {
                     if (is_dir($srcfile)) {
                         file::copydir($srcfile, $dstfile);
                     }
                 }
             }
         }
         closedir($curdir);
     }
 }
開發者ID:meiwenhui,項目名稱:hdwiki,代碼行數:22,代碼來源:file.class.php

示例2: copy_newfile

 function copy_newfile()
 {
     file::copydir(UPGRADE_PATH . $this->package['release_code'] . '/hdwiki', HDWIKI_ROOT);
     return true;
 }
開發者ID:meiwenhui,項目名稱:hdwiki,代碼行數:5,代碼來源:upgrade.class.php

示例3: doinstall

 function doinstall()
 {
     if (isset($this->get[2]) && is_numeric($this->get[2])) {
         $style_download_url = $this->setting['app_url'] . "/hdapp.php?action=download&type=template&install=1&id=" . $this->get[2] . "&url=" . WIKI_URL;
         $zipcontent = @util::hfopen($style_download_url);
         $tmpdir = HDWIKI_ROOT . '/data/tmp/';
         file::forcemkdir($tmpdir);
         $tmpname = $tmpdir . util::random(6) . '.zip';
         file::writetofile($tmpname, $zipcontent);
         require HDWIKI_ROOT . "/lib/zip.class.php";
         require HDWIKI_ROOT . "/lib/xmlparser.class.php";
         $zip = new zip();
         if (!$zip->chk_zip) {
             $this->message($this->view->lang['styleInstallNoZlib'], '');
         }
         $ziplist = @$zip->get_List($tmpname);
         if (!(bool) $ziplist) {
             @unlink($tmpname);
             $this->message($this->view->lang['styleZipFail'], 'BACK');
         }
         $theme_name = $_ENV['theme']->get_theme_name($ziplist);
         @$zip->Extract($tmpname, $tmpdir);
         @unlink($tmpname);
         //move file
         $syle_path = $tmpdir . 'hdwiki';
         if (is_dir(HDWIKI_ROOT . '/style/' . $theme_name)) {
             @file::removedir($syle_path);
             $this->message($this->view->lang['stylePathRepeat'], 'BACK');
         }
         @file::copydir($syle_path, HDWIKI_ROOT);
         @file::removedir($syle_path);
         //save db
         $style_xml = HDWIKI_ROOT . '/style/' . $theme_name . '/desc.xml';
         if (!is_file($style_xml)) {
             $this->message($this->view->lang['styleXmlNotExist'], 'BACK');
         }
         $xmlnav = $_ENV['theme']->read_xml($theme_name);
         $style['name'] = $xmlnav['name'];
         $style['copyright'] = $xmlnav['copyright'];
         $style['path'] = $theme_name;
         $stylecon = $_ENV['theme']->add_check_style($style['path']);
         if ($stylecon == null) {
             $_ENV['theme']->add_style($style);
             $this->cache->removecache('style');
             $this->message($this->view->lang['styleInstallSuccess'], 'BACK');
         } else {
             $this->message($this->view->lang['styleDbPathRepeat'], 'index.php?admin_theme');
         }
     } else {
         $this->message($this->view->lang['commonParametersInvalidTip'], 'index.php?admin_theme');
     }
 }
開發者ID:meiwenhui,項目名稱:hdwiki,代碼行數:52,代碼來源:admin_theme.php


注:本文中的file::copydir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。