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


PHP gpFiles::FileStart方法代码示例

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


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

示例1: SaveData

 /**
  * Save array to a $file location
  *
  * @param string $file The location of the file to be saved
  * @param string $varname The name of the variable being saved
  * @param array $array The value of $varname to be saved
  * @param array $meta meta data to be saved along with $array
  *
  */
 public static function SaveData($file, $varname, $array, $meta = array())
 {
     $file = self::FilePath($file);
     if (gp_data_type === '.json') {
         $json = self::FileStart_Json($file);
         $json[$varname] = $array;
         $json['meta_data'] = $meta;
         $content = json_encode($json);
     } else {
         $content = gpFiles::FileStart($file);
         $content .= gpFiles::ArrayToPHP($varname, $array);
         $content .= "\n\n";
         $content .= gpFiles::ArrayToPHP('meta_data', $meta);
     }
     return gpFiles::Save($file, $content);
 }
开发者ID:stegrams,项目名称:Typesetter,代码行数:25,代码来源:Files.php

示例2: SaveData

 /**
  * Save array to a $file location
  *
  * @param string $file The location of the file to be saved
  * @param string $varname The name of the variable being saved
  * @param array $array The value of $varname to be saved
  * @param array $meta meta data to be saved along with $array
  *
  */
 public static function SaveData($file, $varname, $array, $meta = array())
 {
     global $dataDir;
     if (strpos($file, $dataDir) !== 0) {
         $file = $dataDir . '/data/' . ltrim($file, '/') . '.php';
     }
     if (gp_data_type === '.json') {
         $file = substr($file, 0, -4) . '.gpjson';
         $json = self::FileStart_Json($file);
         $json[$varname] = $array;
         $json['meta_data'] = $meta;
         $content = json_encode($json);
     } else {
         $content = gpFiles::FileStart($file);
         $content .= gpFiles::ArrayToPHP($varname, $array);
         $content .= "\n\n";
         $content .= gpFiles::ArrayToPHP('meta_data', $meta);
     }
     return gpFiles::Save($file, $content);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:29,代码来源:Files.php

示例3: SaveArray

 /**
  * Save array(s) to a $file location
  * Takes 2n+3 arguments
  *
  * @param string $file The location of the file to be saved
  * @param string $varname The name of the variable being saved
  * @param array $array The value of $varname to be saved
  *
  */
 function SaveArray()
 {
     global $gpversion;
     $args = func_get_args();
     $count = count($args);
     if ($count % 2 !== 1 || $count < 3) {
         trigger_error('Wrong argument count ' . $count . ' for gpFiles::SaveArray() ');
         return false;
     }
     $file = array_shift($args);
     $file_stats = array();
     $data = '';
     while (count($args)) {
         $varname = array_shift($args);
         $array = array_shift($args);
         if ($varname == 'file_stats') {
             $file_stats = $array;
         } else {
             $data .= gpFiles::ArrayToPHP($varname, $array);
             $data .= "\n\n";
         }
     }
     $data = gpFiles::FileStart($file, time(), $file_stats) . $data;
     return gpFiles::Save($file, $data);
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:34,代码来源:common.php


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