当前位置: 首页>>代码示例>>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;未经允许,请勿转载。