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


PHP F3::vars方法代码示例

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


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

示例1: start

 /**
 		Bootstrap code
 			@public
 	**/
 static function start()
 {
     // Prohibit multiple calls
     if (self::$vars) {
         return;
     }
     // Handle all exceptions/non-fatal errors
     error_reporting(E_ALL | E_STRICT);
     ini_set('display_errors', 0);
     ini_set('register_globals', 0);
     // Get PHP settings
     $ini = ini_get_all(NULL, FALSE);
     // Intercept errors and send output to browser
     set_error_handler(function ($errno, $errstr) {
         if (error_reporting()) {
             // Error suppression (@) is not enabled
             $self = __CLASS__;
             $self::error(500, $errstr);
         }
     });
     // Do the same for PHP exceptions
     set_exception_handler(function ($ex) {
         if (!count($trace = $ex->getTrace())) {
             // Translate exception trace
             list($trace) = debug_backtrace();
             $arg = $trace['args'][0];
             $trace = array(array('file' => $arg->getFile(), 'line' => $arg->getLine(), 'function' => '{main}', 'args' => array()));
         }
         $self = __CLASS__;
         $self::error(500, $ex->getMessage(), $trace);
         // PHP aborts at this point
     });
     // Apache mod_rewrite enabled?
     if (function_exists('apache_get_modules') && !in_array('mod_rewrite', apache_get_modules())) {
         trigger_error(self::TEXT_Apache);
         return;
     }
     // Fix Apache's VirtualDocumentRoot limitation
     $_SERVER['DOCUMENT_ROOT'] = dirname(self::fixslashes($_SERVER['SCRIPT_FILENAME']));
     // Adjust HTTP request time precision
     $_SERVER['REQUEST_TIME'] = microtime(TRUE);
     // Hydrate framework variables
     $base = self::fixslashes(preg_replace('/\\/[^\\/]+$/', '', $_SERVER['SCRIPT_NAME']));
     $scheme = PHP_SAPI == 'cli' ? NULL : isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ? 'https' : 'http';
     $jar = array('expire' => 0, 'path' => $base ?: '/', 'domain' => '.' . $_SERVER['SERVER_NAME'], 'secure' => $scheme == 'https', 'httponly' => TRUE);
     self::$vars = array('AUTOLOAD' => './', 'BASE' => $base, 'CACHE' => FALSE, 'DEBUG' => 1, 'DNSBL' => NULL, 'ENCODING' => 'utf-8', 'ERROR' => NULL, 'EXTEND' => TRUE, 'EXEMPT' => NULL, 'GUI' => './', 'HOTLINK' => NULL, 'IMPORTS' => './', 'JAR' => $jar, 'LANGUAGE' => NULL, 'LOADED' => NULL, 'LOCALES' => './', 'MAXSIZE' => self::bytes($ini['post_max_size']), 'MUTEX' => 60, 'ONERROR' => NULL, 'PLUGINS' => self::fixslashes(__DIR__) . '/', 'PROTOCOL' => $scheme, 'PROXY' => FALSE, 'PUT' => NULL, 'QUIET' => FALSE, 'ROOT' => $_SERVER['DOCUMENT_ROOT'] . '/', 'ROUTES' => NULL, 'SPAM' => NULL, 'STRICT' => TRUE, 'STATS' => array('MEMORY' => array('start' => memory_get_usage()), 'TIME' => array('start' => microtime(TRUE))), 'TEMP' => 'temp/', 'THROTTLE' => 0, 'TIDY' => array(), 'VERSION' => self::TEXT_AppName . ' ' . self::TEXT_Version, 'WHOIS' => 'whois.internic.net');
     // Alias the GUI variable (2.0+)
     self::$vars['UI'] =& self::$vars['GUI'];
     // Create convenience containers for PHP globals
     foreach (explode('|', self::PHP_Globals) as $var) {
         // Sync framework and PHP globals
         self::$vars[$var] =& $GLOBALS['_' . $var];
         if (isset($ini['magic_quotes_gpc']) && $ini['magic_quotes_gpc'] && preg_match('/^[GPCR]/', $var)) {
             // Corrective action on PHP magic quotes
             array_walk_recursive(self::$vars[$var], function (&$val) {
                 $val = stripslashes($val);
             });
         }
     }
     if (PHP_SAPI == 'cli') {
         // Command line: Parse GET variables in URL, if any
         if (isset($_SERVER['argc']) && $_SERVER['argc'] < 2) {
             array_push($_SERVER['argv'], '/');
         }
         // Detect host name from environment
         $_SERVER['SERVER_NAME'] = gethostname();
         // Convert URI to human-readable string
         self::mock('GET ' . $_SERVER['argv'][1]);
     }
     // Initialize autoload stack and shutdown sequence
     spl_autoload_register(__CLASS__ . '::autoload');
     register_shutdown_function(__CLASS__ . '::stop');
 }
开发者ID:nian2go,项目名称:fatfree,代码行数:77,代码来源:base.php


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