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


PHP Browser::header方法代码示例

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


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

示例1: _interpret_

 public function _interpret_($info, $params)
 {
     $cache = $info["cache"];
     $perform = true;
     $md5key = null;
     if ($cache) {
         $this->responseCache = new RxCache('responseCache');
         $this->headerCache = new RxCache('headerCache');
         $this->cacheDuration = 300;
         // in seconds
         // Client is told to cache these results for set duration
         header('Cache-Control: public,max-age=' . $this->cacheDuration . ',must-revalidate');
         header('Expires: ' . gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $this->cacheDuration) . ' GMT');
         header('Last-modified: ' . gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME']) . ' GMT');
         // Pragma header removed should the server happen to set it automatically
         // Pragma headers can make browser misbehave and still ask data from server
         header_remove('Pragma');
         $md5key = md5($_SERVER[REQUEST_URI]);
         $response = $this->responseCache->get($md5key, FALSE);
         if (!empty($response)) {
             $perform = false;
             echo $response;
             $headerstr = $this->headerCache->get($md5key);
             $headers = explode(self::$HEADER_GLUE, $headerstr);
             foreach ($headers as $header) {
                 header($header);
             }
             Browser::header("fromCahce");
             exit;
         } else {
             // ob_start('ob_gzhandler');
         }
     }
     if ($perform) {
         $this->_interceptor_($info, call_method_by_object($this, $info["method"], $params, $info["requestParams"]));
     }
     if ($perform && $cache) {
         $response = ob_get_contents();
         $this->responseCache->set($md5key, $response);
         $this->headerCache->set($md5key, implode(self::$HEADER_GLUE, headers_list()));
         // ob_end_flush();
         // echo $response;
     }
 }
开发者ID:rudraks,项目名称:core,代码行数:44,代码来源:AbstractController.php

示例2: read

 public static function read($glob_config, $file, $file2 = null)
 {
     $debug = isset($glob_config["RX_MODE_DEBUG"]) && $glob_config["RX_MODE_DEBUG"] == TRUE;
     $debug_build = isset($_REQUEST["RX_MODE_BUILD"]) && $_REQUEST["RX_MODE_BUILD"] == TRUE;
     self::$cache = new RxCache("config", true);
     $reloadCache = FALSE;
     header("FLAGS:" . self::$cache->isEmpty() . "-" . $glob_config["RX_MODE_DEBUG"] . "-" . $debug);
     if (self::$cache->isEmpty()) {
         $reloadCache = TRUE;
     } else {
         $_glob_config = self::$cache->get("GLOBAL");
         if ($_glob_config["RX_MODE_DEBUG"] != $debug || isset($_GET['ModPagespeed'])) {
             $reloadCache = TRUE;
         }
     }
     $RELOAD_VERSION = self::$cache->get("RELOAD_VERSION");
     if ($debug_build || $debug || $reloadCache) {
         FileUtil::build_check();
         define("FIRST_RELOAD", TRUE);
         $RELOAD_VERSION = microtime(true);
         RxCache::clean();
         self::$cache->set("RELOAD_VERSION", $RELOAD_VERSION);
         $DEFAULT_CONFIG = parse_ini_file("_project.properties", TRUE);
         $localConfig = array();
         if (file_exists($file)) {
             $localConfig = parse_ini_file($file, TRUE);
         }
         $localConfig = array_replace_recursive($DEFAULT_CONFIG, $localConfig);
         if ($file2 != null && file_exists($file2)) {
             $localConfig = array_replace_recursive($localConfig, parse_ini_file($file2, TRUE));
         }
         self::$cache->merge($localConfig);
         self::$cache->set('GLOBAL', array_merge($DEFAULT_CONFIG['GLOBAL'], $localConfig['GLOBAL'], $glob_config));
         $reloadMode = isset($_GET['ModPagespeed']) ? $_GET['ModPagespeed'] : NULL;
         call_user_func(rx_function("rx_reload_cache"), $reloadMode);
         self::$cache->save();
         Browser::header("RX_MODE_BUILD");
     } else {
         define("FIRST_RELOAD", FALSE);
     }
     define("RELOAD_VERSION", $RELOAD_VERSION);
     return self::$cache->getArray();
 }
开发者ID:rudraks,项目名称:boot,代码行数:43,代码来源:RudraX.php

示例3: invokeHandler

 public function invokeHandler()
 {
     //VARIABLES TO DETERMINE RESOURCES
     //RELOAD_VERSION
     //RX_ENCRYPT_PATH
     //$const = Config::getSection("CLIENT_CONST");
     //$const['RX_JS_MIN']
     //$const['RX_JS_MERGE']
     $hdr = new Header();
     $cache_ext = '.js';
     //file extension
     $cache_time = 3600;
     //Cache file expires afere these seconds (1 hour = 3600 sec)
     $cache_folder = Header::$BUILD_PATH;
     //folder to store Cache files
     //$ignore_pages   = array('', '');
     $dynamic_url = $_GET['@'];
     //$_SERVER['QUERY_STRING']; // requested dynamic page (full url)
     $version = $_GET['_'];
     //echo "Q==".$_SERVER['QUERY_STRING'];
     $cache_file = $cache_folder . md5($dynamic_url) . "-" . $version . $cache_ext;
     // construct a cache file
     $ignore = false;
     //(in_array($dynamic_url,$ignore_pages))?true:false; //check if url is in ignore list
     Browser::header("RX_MODE_DEBUG" . RX_MODE_DEBUG);
     if (!RX_MODE_DEBUG) {
         //if (!$ignore && file_exists($cache_file) && time() - $cache_time < filemtime($cache_file)) { //check Cache exist and it's not expired.
         if (!$ignore && file_exists($cache_file)) {
             //check Cache exist and it's not expired.
             ob_start('ob_gzhandler');
             //Turn on output buffering, "ob_gzhandler" for the compressed page with gzip.
             echo '/** cached page - ' . date('l jS \\of F Y h:i:s A', filemtime($cache_file)) . ',';
             echo "\n * Page : " . $dynamic_url . "\n * NewMD5" . $cache_file . "\n */\n";
             $this->displayResourceFile($cache_file);
             //read Cache file
             $this->writeHeaders($cache_file);
             //$this->redirectFile($cache_file);
             ob_end_flush();
             //Flush and turn off output buffering
             exit;
             //no need to proceed further, exit the flow.
         }
     }
     //Turn on output buffering with gzip compression.
     ob_start('ob_gzhandler');
     $files = explode(",", $_GET['@']);
     $hdr->printCombinedJs($files);
     if (!is_dir($cache_folder)) {
         //create a new folder if we need to
         mkdir($cache_folder);
     }
     if (!$ignore) {
         $fp = fopen($cache_file, 'w');
         //open file for writing
         fwrite($fp, ob_get_contents());
         //write contents of the output buffer in Cache file
         fclose($fp);
         //Close file pointer
     }
     $this->writeHeaders($cache_file);
     //Browser::printlogsOnHeader();
     if (RX_MODE_DEBUG) {
         //unlink($cache_file);
         header("X-LOG-DELTED: TRUE");
     }
     ob_end_flush();
 }
开发者ID:rudraks,项目名称:core,代码行数:67,代码来源:ResourceHandler.php

示例4: invoke

 public static function invoke($_conf = array())
 {
     Browser::time("invoked");
     $global_config = array_merge(array('CONTROLLER' => 'web.php', 'DEFAULT_DB' => 'DB1', 'CONSOLE_FUN' => 'console.log', 'RX_MODE_DEBUG' => FALSE, 'PROJECT_ROOT_DIR' => "../"), $_conf);
     // Loads all the Constants
     define('PROJECT_ROOT_DIR', $global_config['PROJECT_ROOT_DIR']);
     define('PROJECT_ID', md5(PROJECT_ROOT_DIR . $global_config['CONTROLLER']));
     FileUtil::$PROJECT_ROOT_DIR = PROJECT_ROOT_DIR;
     include_once 'constants.php';
     ob_start();
     session_start();
     Config::load(PROJECT_ROOT_DIR . "app/meta/project.properties", PROJECT_ROOT_DIR . "config/project.properties", $global_config);
     // Initialze Rudrax
     self::init();
     Browser::time("After Init");
     $config = Config::getSection("GLOBAL");
     $db_connect = false;
     Browser::time("Before DB Connect");
     /**
      * NOTE:- NO need to connect DB automatically, it should be connecte donly when required;
      */
     // if (isset ( $config ["DEFAULT_DB"] )) {
     // $RDb = self::getDB ( $config ["DEFAULT_DB"] );
     // $db_connect = true;
     // }
     Browser::time("Before-First Reload");
     // Define Custom Request Plugs
     if (FIRST_RELOAD) {
         ClassUtil::scan();
     }
     self::findAndExecuteController();
     self::invokeController();
     DBService::close();
     Browser::time("Before Saving");
     Config::save();
     Browser::time("After Saving");
     $clientConfig = Config::get("CLIENT_CONST");
     /*
      * $RX_ENCRYPT_PATH is applicable only if either MINFY or MERGE, this variable ise used by .htaccess file
      */
     $RX_ENCRYPT_PATH = !RX_MODE_DEBUG && ($clientConfig["RX_JS_MIN"] || $clientConfig["RX_JS_MERGE"]);
     Browser::header(RX_MODE_DEBUG . "." . $clientConfig["RX_JS_MIN"] . "." . $clientConfig["RX_JS_MERGE"]);
     if ($RX_ENCRYPT_PATH) {
         setcookie('RX-ENCRYPT-PATH', "TRUE", 0, "/");
         define("RX_ENCRYPT_PATH", true);
     } else {
         removecookie('RX-ENCRYPT-PATH');
         define("RX_ENCRYPT_PATH", false);
     }
     Browser::time("Invoked:Ends");
 }
开发者ID:rudraks,项目名称:core,代码行数:51,代码来源:RudraX.php


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