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


PHP JFile::Write方法代碼示例

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


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

示例1: doExecute

 /**
  * Entry point for the script
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     jimport('joomla.filesystem.file');
     if (file_exists(JPATH_BASE . '/configuration.php') || file_exists(JPATH_BASE . '/config.php')) {
         $configfile = file_exists(JPATH_BASE . 'configuration.php') ? JPATH_BASE . '/config.php' : JPATH_BASE . '/configuration.php';
         if (is_writable($configfile)) {
             $config = file_get_contents($configfile);
             //Do a simple replace for the CMS and old school applications
             $newconfig = str_replace('public $offline = \'0\'', 'public $offline = \'1\'', $config);
             // Newer applications generally use JSON instead.
             if (!$newconfig) {
                 $newconfig = str_replace('"public $offline":"0"', '"public $offline":"1"', $config);
             }
             if (!$newconfig) {
                 $this->out('This application does not have an offline configuration setting.');
             } else {
                 JFile::Write($configfile, &$newconfig);
                 $this->out('Site is offline');
             }
         } else {
             $this->out('The file is not writable, you need to change the file permissions first.');
             $this->out();
         }
     } else {
         $this->out('This application does not have a configuration file');
     }
     $this->out();
 }
開發者ID:joomlla,項目名稱:jacs,代碼行數:35,代碼來源:TakeOffline.php

示例2: shSaveFile

function shSaveFile($shFileName, $fileData)
{
    if (empty($shFileName)) {
        return;
    }
    $fileIsThere = file_exists($shFileName);
    if (!$fileIsThere || $fileIsThere && is_writable($shFileName)) {
        if (is_array($fileData)) {
            $fileData = implode("\n", $fileData);
            //make sure we write a string
        }
        JFile::Write($shFileName, empty($fileData) ? '' : $fileData);
    }
}
開發者ID:sangkasi,項目名稱:joomla,代碼行數:14,代碼來源:sh404sef.class.php


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