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


PHP Storage::Get方法代碼示例

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


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

示例1: Cache

 /**
  * Função para definir uso de cache na Query
  * 
  * @access public
  * @return \MySQLTableCached
  */
 public function Cache($iTimeout = 3600)
 {
     Storage::Set("cachedb.timeout", $iTimeout);
     Events::Set("BeforeQuery", function ($sSQL, $fCallback) {
         if (Storage::Get("cachedb.enabled", false)) {
             $mCache = @CacheDB::Get(sha1($sSQL));
             if ($mCache !== false && !is_null($mCache)) {
                 if ($fCallback) {
                     $fCallback(json_decode($mCache, true), null);
                 }
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     });
     Events::Set("AfterQuery", function ($sSQL, $aResult) {
         if (Storage::Get("cachedb.enabled", false)) {
             @CacheDB::Set(sha1($sSQL), json_encode($aResult), Storage::Get("cachedb.timeout", 3600));
         }
     });
     return $this;
 }
開發者ID:magicphp,項目名稱:cachedb,代碼行數:31,代碼來源:mysqlcache.class.php

示例2: Call

 /**
  * Function to call the event
  * 
  * @static
  * @access public
  * @param string $sName
  * @param array $aParams
  * @return mixed
  */
 public static function Call($sName, $aParams = null)
 {
     $oThis = self::CreateInstanceIfNotExists();
     $sName = strtolower(str_replace(array("/", "\\", "--"), "-", $sName));
     //Bugfix
     if (array_key_exists($sName, $oThis->aEvents)) {
         switch ($oThis->aEvents[$sName]["type"]) {
             case "perroute":
                 $sCurrentRoute = strtolower(str_replace(array("/", "\\", "--"), "-", Storage::Get("route")));
                 //Bugfix
                 $sRoute = strtolower($oThis->aEvents[$sName]["method"] . "_" . $oThis->aEvents[$sName]["route"]);
                 if ($sRoute == $sCurrentRoute) {
                     return call_user_func($oThis->aEvents[$sName]["func"], $aParams);
                 }
                 break;
             case "default":
                 return call_user_func($oThis->aEvents[$sName]["func"], $aParams);
                 break;
         }
     } else {
         return false;
     }
 }
開發者ID:magicphp,項目名稱:framework,代碼行數:32,代碼來源:events.class.php

示例3: LoadApp

 /**
  * Function to load modules
  * 
  * @static
  * @access public
  * @return void
  */
 public static function LoadApp()
 {
     //If the module exists Express should be loaded first
     if (is_dir(Storage::Join("dir.app", "express"))) {
         if (file_exists(Storage::Join("dir.app", "express" . SP . "settings.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "settings.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "include.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "include.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "routes.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "routes.php");
         }
         if (file_exists(Storage::Join("dir.app", "express" . SP . "events.php"))) {
             require_once Storage::Join("dir.app", "express" . SP . "events.php");
         }
     }
     //Load Modules
     $aModulesDirectories = glob(Storage::Get("dir.app") . "*", GLOB_ONLYDIR);
     foreach ($aModulesDirectories as $sModuleDiretory) {
         $bStatus = file_exists($sModuleDiretory . SP . "status.txt") ? intval(file_get_contents($sModuleDiretory . SP . "status.txt")) == 1 : false;
         $bInstaled = file_exists($sModuleDiretory . SP . "settings.php");
         if ($bStatus && $bInstaled && basename($sModuleDiretory) != "express") {
             if (file_exists($sModuleDiretory . SP . "settings.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "settings.php";
             }
             if (file_exists($sModuleDiretory . SP . "include.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "include.php";
             }
             if (file_exists($sModuleDiretory . SP . "routes.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "routes.php";
             }
             if (file_exists($sModuleDiretory . SP . "events.php") && $bStatus) {
                 require_once $sModuleDiretory . SP . "events.php";
             }
         }
     }
 }
開發者ID:magicphp,項目名稱:magicphp,代碼行數:45,代碼來源:bootstrap.php

示例4: Send

 /**
  * Function to send output
  *
  * @access public
  * @return void
  */
 public static function Send()
 {
     $oThis = self::CreateInstanceIfNotExists();
     if (is_object($oThis->oSmarty)) {
         $oThis->CreateCacheCSS();
         $oThis->CreateCacheJS();
         Storage::AssignSmarty($oThis->oSmarty);
         Events::Call("BeforeSendingOutput");
         $oThis->oSmarty->display($oThis->sTemplateFilename);
     } else {
         $oThis = self::CreateInstanceIfNotExists();
         $oThis->CreateCacheCSS();
         $oThis->CreateCacheJS();
         $oThis->IncludeTemplate();
         $oThis->ReplaceVars();
         $oThis->RemoveUndefinedVars();
         $oThis->CheckConditions();
         //$oThis->ClearList();
         Events::Call("BeforeSendingOutput");
         @header('HTTP/1.1 200 OK');
         @header("Content-Type: text/html; charset=" . strtoupper(Storage::Get("app.charset", "UTF-8")), true);
         try {
             //var_dump($oThis->sBuffer); die();
             eval('?> ' . $oThis->sBuffer);
             die;
         } catch (Exception $e) {
             die($e->getMessage());
         }
     }
 }
開發者ID:magicphp,項目名稱:framework,代碼行數:36,代碼來源:output.class.php


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