當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。