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


PHP Stack::Ahead方法代碼示例

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


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

示例1: __construct

 public function __construct()
 {
     // Enforce time limit, ignore aborts
     set_time_limit(2);
     ignore_user_abort();
     // Load constants
     require_once 'system/core/constants.php';
     // Set error reporting (debuging mode)
     if (debug) {
         error_reporting(E_ALL ^ E_DEPRECATED);
     }
     // Load security
     require_once 'system/core/security.php';
     // Load dependencies
     require_once 'system/core/dependencies.php';
     // Session handling
     date_default_timezone_set(local_timezone);
     session_start();
     // Initialize the stack (stack routing)
     Stack::Push((isset($_REQUEST[route_key]) and trim($_REQUEST[route_key]) != '') ? $_REQUEST[route_key] : route_home);
     // Initialize buffering
     ob_start();
     // Cycle the processes stack, run all the processors sucessively until the stack is empty.
     while (Stack::Ahead() > 0) {
         // Pre-init / re-init 'found' flag (in case the stack had multiple items)
         $found = false;
         // Catch anything that might happen
         try {
             foreach (route_repos as $rep => $types) {
                 if (!is_array($types)) {
                     $types = array($types);
                 }
                 foreach ($types as $t) {
                     $p = $rep . Stack::Top() . $t;
                     if (is_file($p)) {
                         $found = true;
                         // Update the output sequencer
                         Output::Path(Stack::Path());
                         if (!(include $p)) {
                             throw new SystemException(sprintf(err_include500, Stack::Top()));
                         }
                         break 2;
                     }
                 }
             }
             if (!$found) {
                 throw new SystemException(sprintf(err_include404, Stack::Top()));
             }
             // Processor completed; pop the stack
             Stack::Pop();
         } catch (Exception $e) {
             throw new SystemException($e);
         }
     }
     $this->buffer = ob_get_contents();
     ob_end_clean();
     // Pass the buffer to the output handler for final render
     Output::Flush($this->buffer);
     exit(1);
 }
開發者ID:xcelaio,項目名稱:xcela,代碼行數:60,代碼來源:core.php


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