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


PHP Storage::Set方法代码示例

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


在下文中一共展示了Storage::Set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Start

 /**
  * Function to start the module
  * 
  * @access public
  * @return void
  */
 public function Start()
 {
     if (file_exists($this->sModuleDiretory . SP . "status.txt")) {
         $iStatus = intval(file_get_contents($this->sModuleDiretory . SP . "status.txt"));
         $bStatus = $iStatus == 1;
         Storage::Set("app." . $this->sModuleName . ".enabled", $bStatus);
     } else {
         $bStatus = true;
         file_put_contents($this->sModuleDiretory . SP . "status.txt", "1");
         Storage::Set("app." . $this->sModuleName . ".enabled", true);
     }
     if ($bStatus) {
         Storage::SetArray("class.list", "module." . $this->sModuleName, $this->sModuleDiretory . "core" . SP);
         //Diretory Paths
         Storage::Set("app." . $this->sModuleName, $this->sModuleDiretory);
         Storage::Set("app." . $this->sModuleName . ".shell.css", $this->sModuleDiretory . "shell" . SP . "css" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.tpl", $this->sModuleDiretory . "shell" . SP . "tpl" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.js", $this->sModuleDiretory . "shell" . SP . "js" . SP);
         Storage::Set("app." . $this->sModuleName . ".shell.img", $this->sModuleDiretory . "shell" . SP . "img" . SP);
         //Web Paths
         Storage::Set("virtual." . $this->sModuleName . ".shell.img", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/img/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.tpl", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/tpl/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.js", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/js/"));
         Storage::Set("virtual." . $this->sModuleName . ".shell.css", Storage::Join("route.root", "app/" . $this->sModuleName . "/shell/css/"));
         //Loading submodules
         if (is_dir($this->sModuleDiretory . "modules")) {
             $aModulesDirectories = glob($this->sModuleDiretory . "modules" . SP . "*", GLOB_ONLYDIR);
             foreach ($aModulesDirectories as $sModuleDiretory) {
                 if (file_exists($sModuleDiretory . SP . "status.txt")) {
                     $bStatus = intval(file_get_contents($sModuleDiretory . SP . "status.txt")) == 1;
                 } else {
                     $bStatus = false;
                 }
                 if ($bStatus) {
                     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,项目名称:framework,代码行数:57,代码来源:module.class.php

示例3: Start

 /**
  * Starting the application
  * 
  * @static
  * @access public
  * @return void
  */
 public static function Start()
 {
     $oThis = self::CreateInstanceIfNotExists();
     //setting autoload
     spl_autoload_register(array($oThis, "AutoLoad"));
     //Configuring basic directories
     Storage::Set("dir.root", __DIR__ . SP);
     Storage::Set("dir.public", __DIR__ . SP . "public" . SP);
     Storage::Set("dir.public.assets", __DIR__ . SP . "public" . SP . "assets" . SP);
     Storage::Set("dir.public.compiles", __DIR__ . SP . "public" . SP . "compiles" . SP);
     Storage::Set("dir.public.configs", __DIR__ . SP . "public" . SP . "configs" . SP);
     Storage::Set("dir.app", __DIR__ . SP . "app" . SP);
     //Configuring default route
     Storage::Set("route.root", "//" . $_SERVER["SERVER_NAME"] . str_replace(array("index.php", " "), array("", "%20"), $_SERVER["SCRIPT_NAME"]));
     //Bugfix
     $oThis->LoadApp();
 }
开发者ID:magicphp,项目名称:magicphp,代码行数:24,代码来源:bootstrap.php

示例4: RestParams

 /**
  * Function to return parameters passed by PUT or DELETE methods
  * 
  * @static
  * @access public
  * @param boolean $bReturn
  * @return mixed
  */
 public static function RestParams($bReturn = false)
 {
     $sBuffer = file_get_contents("php://input");
     $aParams = explode("&", $sBuffer);
     $aReturn = array();
     foreach ($aParams as $sParam) {
         @(list($mKey, $mValue) = @explode("=", $sParam));
         $mValue = urldecode($mValue);
         if (!empty($mKey) && !empty($mValue)) {
             Storage::Set(strtolower(Routes::Restful()) . "." . $mKey, $mValue);
             if ($bReturn) {
                 $aReturn[strtolower(Routes::Restful()) . "." . $mKey] = $mValue;
             }
         }
     }
     if ($bReturn) {
         return $aReturn;
     }
 }
开发者ID:magicphp,项目名称:framework,代码行数:27,代码来源:routes.class.php

示例5: Start

 /**
  * Função para iniciar serviço de armazenamento de cache em memória
  * 
  * @access public
  * @param string $sHostname Hostname do servidor de cache
  * @param integer $iPort Porta do servidor (Padrão: 11211)
  * @return boolean
  */
 public static function Start($sHostname, $iPort = 11211)
 {
     $oThis = self::CreateInstanceIfNotExists();
     if (class_exists("memcached")) {
         if (!empty($sHostname) && is_int($iPort)) {
             $oThis->oMemCache = new memcached(array("servers" => array($sHostname . ":" . $iPort), "debug" => false, "compress_threshold" => 10240, "persistant" => true));
             if (is_object($oThis->oMemCache)) {
                 Storage::Set("cachedb.enabled", true);
                 return true;
             } else {
                 Storage::Set("cachedb.enabled", false);
                 return false;
             }
         } else {
             Storage::Set("cachedb.enabled", false);
             return false;
         }
     } else {
         Storage::Set("cachedb.enabled", false);
         return false;
     }
 }
开发者ID:magicphp,项目名称:cachedb,代码行数:30,代码来源:cachedb.class.php

示例6:

<?php

/**
 * Settings
 */
//Default Settings
Storage::Set("app.charset", "UTF-8");
Storage::Set("debug", true);
Storage::Set("app.minified", false);
//Smarty Settings
Storage::Set("smarty.dir.compile", __DIR__ . SP . "public" . SP . "compiles" . SP);
Storage::Set("smarty.dir.config", __DIR__ . SP . "public" . SP . "configs" . SP);
开发者ID:magicphp,项目名称:magicphp,代码行数:12,代码来源:settings.php

示例7: Login

 /**
  * Function to perform the login session
  * 
  * @static
  * @access public
  * @param mixed $mId User ID
  * @param string $sUsername Username    
  * @param string $sName Name
  * @param integer $iTimeout Maximum time of permanence in the session
  * @param boolean $bRoot Defines the user as root
  * @return void
  */
 public static function Login($mId, $sUsername, $sName, $iTimeout = 3600, $bRoot = false)
 {
     $oThis = self::CreateInstanceIfNotExists();
     if ($oThis->bStarted) {
         $iTimeout = time() + $iTimeout;
         $oThis->aAuth = array("id" => $mId, "name" => $sName, "username" => $sUsername, "timeout" => $iTimeout, "root" => $bRoot);
         $_SESSION[$oThis->sName]["authentication"] = $oThis->aAuth;
         if (!empty($oThis->aAuth)) {
             Storage::Set("user.id", $oThis->aAuth["id"]);
             Storage::Set("user.name", $oThis->aAuth["name"]);
             Storage::Set("user.username", $oThis->aAuth["username"]);
             Storage::Set("user.root", $oThis->aAuth["root"]);
             Storage::Set("session.timeout.login", $iTimeout);
         }
     }
 }
开发者ID:magicphp,项目名称:framework,代码行数:28,代码来源:session.class.php

示例8: CreateCacheJS

 /**
  * Function to create the Javascript file cache
  *
  * @access public
  * @param boolean $bForce Forcing creation
  * @return void
  */
 public static function CreateCacheJS()
 {
     $oThis = self::CreateInstanceIfNotExists();
     if (count($oThis->aJS) > 0) {
         $sCacheFilename = Storage::Join("dir.public.assets", strtolower($oThis->sNamespace) . ".js");
         Storage::Set("assets.js", Storage::Join("route.root", "public/assets/" . strtolower($oThis->sNamespace) . ".js"));
         if (!file_exists($sCacheFilename) || Storage::Get("debug", false)) {
             $sBuffer = "";
             foreach ($oThis->aJS as $sAppendBuffer) {
                 $sBuffer .= $sAppendBuffer;
             }
             file_put_contents($sCacheFilename, $sBuffer);
         }
     }
 }
开发者ID:magicphp,项目名称:framework,代码行数:22,代码来源:output.class.php

示例9:

<?php

/**
 * Settings
 * 
 * @package     MagicPHP Hello World
 * @author      André Ferreira <andrehrf@gmail.com>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php) 
 */
Storage::Set("app.title", "MagicPHP - Hello World");
开发者ID:magicphp,项目名称:magicphp,代码行数:10,代码来源:settings.php


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