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


PHP Files::rename方法代码示例

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


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

示例1: save

 /**
  * Save the local configuration file
  */
 public function save()
 {
     if ($this->strTop == '') {
         $this->strTop = '<?php';
     }
     $strFile = trim($this->strTop) . "\n\n";
     $strFile .= "### INSTALL SCRIPT START ###\n";
     foreach ($this->arrData as $k => $v) {
         $strFile .= "{$k} = {$v}\n";
     }
     $strFile .= "### INSTALL SCRIPT STOP ###\n";
     $this->strBottom = trim($this->strBottom);
     if ($this->strBottom != '') {
         $strFile .= $this->strBottom . "\n";
     }
     $strTemp = md5(uniqid(mt_rand(), true));
     // Write to a temp file first
     $objFile = fopen(TL_ROOT . '/system/tmp/' . $strTemp, 'wb');
     fputs($objFile, $strFile);
     fclose($objFile);
     // Then move the file to its final destination
     $this->Files->rename('system/tmp/' . $strTemp, 'system/config/localconfig.php');
     // Reset the Zend Optimizer+ cache (unfortunately no API to delete just a single file)
     if (function_exists('accelerator_reset')) {
         accelerator_reset();
     }
 }
开发者ID:rikaix,项目名称:core,代码行数:30,代码来源:Config.php

示例2: save

 /**
  * Save the local configuration file
  */
 public function save()
 {
     if ($this->strTop == '') {
         $this->strTop = '<?php';
     }
     $strFile = trim($this->strTop) . "\n\n";
     $strFile .= "### INSTALL SCRIPT START ###\n";
     foreach ($this->arrData as $k => $v) {
         $strFile .= "{$k} = {$v}\n";
     }
     $strFile .= "### INSTALL SCRIPT STOP ###\n";
     $this->strBottom = trim($this->strBottom);
     if ($this->strBottom != '') {
         $strFile .= "\n" . $this->strBottom . "\n";
     }
     $strTemp = md5(uniqid(mt_rand(), true));
     // Write to a temp file first
     $objFile = fopen(TL_ROOT . '/system/tmp/' . $strTemp, 'wb');
     fputs($objFile, $strFile);
     fclose($objFile);
     // Make sure the file has been written (see #4483)
     if (!filesize(TL_ROOT . '/system/tmp/' . $strTemp)) {
         \System::log('The local configuration file could not be written. Have your reached your quota limit?', __METHOD__, TL_ERROR);
         return;
     }
     // Adjust the file permissions (see #8178)
     $this->Files->chmod('system/tmp/' . $strTemp, \Config::get('defaultFileChmod'));
     // Then move the file to its final destination
     $this->Files->rename('system/tmp/' . $strTemp, 'system/config/localconfig.php');
     // Reset the Zend OPcache
     if (function_exists('opcache_invalidate')) {
         opcache_invalidate(TL_ROOT . '/system/config/localconfig.php', true);
     }
     // Reset the Zend Optimizer+ cache (unfortunately no API to delete just a single file)
     if (function_exists('accelerator_reset')) {
         accelerator_reset();
     }
     // Recompile the APC file (thanks to Trenker)
     if (function_exists('apc_compile_file') && !ini_get('apc.stat')) {
         apc_compile_file(TL_ROOT . '/system/config/localconfig.php');
     }
     // Purge the eAccelerator cache (thanks to Trenker)
     if (function_exists('eaccelerator_purge') && !ini_get('eaccelerator.check_mtime')) {
         @eaccelerator_purge();
     }
     // Purge the XCache cache (thanks to Trenker)
     if (function_exists('xcache_count') && !ini_get('xcache.stat')) {
         if (($count = xcache_count(XC_TYPE_PHP)) > 0) {
             for ($id = 0; $id < $count; $id++) {
                 xcache_clear_cache(XC_TYPE_PHP, $id);
             }
         }
     }
     $this->blnIsModified = false;
 }
开发者ID:contao,项目名称:core-bundle,代码行数:58,代码来源:Config.php

示例3: setFavorite

 /**
  * Set favorite
  * 
  * @param boolean $favorite
  * @return ClipboardXmlElement 
  */
 public function setFavorite($favorite)
 {
     if (!is_null($this->_favorite) || $this->_favorite != $favorite) {
         $strNewFileName = $this->_setNewFileName('favorite', $favorite ? 'F' : 'N');
         $this->_objFiles->rename($this->_path . '/' . $this->_filename, $this->_path . '/' . $strNewFileName);
         $this->_filename = $strNewFileName;
         $this->_setFileInfo();
     }
     $this->_favorite = $favorite;
     return $this;
 }
开发者ID:corelgott,项目名称:clipboard,代码行数:17,代码来源:ClipboardXmlElement.php

示例4: processPaste

 function processPaste()
 {
     switch ($_GET['paste']) {
         case 'copyFile':
             $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $file = $_GET['file'];
             $dest = Files::makeFile($this->getImagesDir(), $_GET['dir']);
             return Files::copyFile($src, $dest, $file);
             break;
         case 'copyDir':
             $basePath = $this->getImagesDir();
             $src = $_GET['srcdir'] . $_GET['file'];
             $dest = $_GET['dir'] . $_GET['file'];
             return Files::copyDir($basePath, $src, $dest);
             break;
         case 'moveFile':
             $src = Files::makePath($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $dest = Files::makePath($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
             return Files::rename($src, $dest);
             break;
         case 'moveDir':
             $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $dest = Files::makeFile($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
             return Files::rename($src, $dest);
             break;
     }
 }
开发者ID:vnotebaert,项目名称:qcmphp,代码行数:27,代码来源:ExtendedFileManager.php


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