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


PHP loader::_in_ajax方法代码示例

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


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

示例1: _bootstrap

 /**
  * BootStrap kernel
  */
 protected static function _bootstrap()
 {
     // check for php version
     if (intval(phpversion()) < 5) {
         die('Unsupported PHP version.<br/>Require PHP version 5 or greater.<br/>Time to upgrade?');
     }
     self::$framework_path = self::fix_path(dirname(__FILE__) . '/../../');
     /*
     if (empty($_SERVER['DOCUMENT_ROOT'])) {    
        self::set_root(dirname(__FILE__) . '/../../');   // from shell?
        self::$_in_shell = true;
     }
     else {
        // header('Content-Type: text/html; charset=' . $config['charset']);
        self::set_root($_SERVER['DOCUMENT_ROOT']);   
     }
     */
     if (empty($_SERVER['DOCUMENT_ROOT'])) {
         self::$_in_shell = true;
     }
     $root = self::_option(self::OPTION_ROOT);
     if (!empty($root)) {
         self::set_root($root);
     } else {
         // assume TF_ROOT is ./
         self::set_root(dirname(__FILE__) . '/../../../');
     }
     // append include_path, app has more priority to overrides framework files
     set_include_path(get_include_path() . PATH_SEPARATOR . self::$framework_path);
     // ajax check
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($_REQUEST['with_ajax'])) {
         if ('json' === @$_REQUEST['with_ajax']) {
             self::$_in_ajax = 'json';
         } else {
             // 1 - emulated
             self::$_in_ajax = isset($_REQUEST['with_ajax']) ? 1 : true;
         }
     }
     self::autoload();
     // kick core
     self::core();
     if (self::_option(self::OPTION_NO_INIT)) {
         return;
     }
     /* Functions registered with register_shutdown_function are called before deconstructors, at least as of PHP 5.2.1.
        This contradicts an earlier commenter who claims that objects cannot be utilized in functions called from register_shutdown_function. */
     // register_shutdown_function(array($core, 'shutdown'));
     // @todo  test env
     if (!self::_option(self::OPTION_TESTING) && class_exists('\\Whoops\\Run')) {
         self::core()->init();
     } else {
         try {
             self::core()->init();
         } catch (Exception $e) {
             if (is_callable(array($e, 'display_error'))) {
                 $e->display_error();
             } else {
                 // No dispaly error in exception
                 if (class_exists('tf_exception', 0)) {
                     echo tf_exception::generic_display_error($e);
                 } else {
                     printf("Unknown error : %s\n", $e->getMessage());
                 }
             }
         }
     }
     if (self::_option(self::OPTION_AUTORUN)) {
         self::main();
     }
     core::time_check('core', true, true);
     core::dprint('mount / from ' . self::get_root());
     core::dprint('booting done...');
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:76,代码来源:loader.php

示例2: bootstrap

 /**
  * BootStrap kernel
  */
 static function bootstrap()
 {
     // check for php version
     if (intval(phpversion()) < 5) {
         die('Unsupported PHP version.<br/>Require PHP version 5 or greater.<br/>Time to upgrade?');
     }
     self::$framework_path = self::fix_path(dirname(__FILE__) . '/../../');
     /*
     if (empty($_SERVER['DOCUMENT_ROOT'])) {    
        self::set_root(dirname(__FILE__) . '/../../');   // from shell?
        self::$_in_shell = true;
     }
     else {
        // header('Content-Type: text/html; charset=' . $config['charset']);
        self::set_root($_SERVER['DOCUMENT_ROOT']);   
     }
     */
     if (empty($_SERVER['DOCUMENT_ROOT'])) {
         self::$_in_shell = true;
     }
     if (defined('TF_ROOT')) {
         self::set_root(TF_ROOT);
     } else {
         // assume TF_ROOT is ./
         self::set_root(dirname(__FILE__) . '/../../');
     }
     // append include_path, app has more priority to overrides framework files
     set_include_path(get_include_path() . PATH_SEPARATOR . self::$framework_path);
     // ajax check
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($_REQUEST['with_ajax'])) {
         self::$_in_ajax = true;
     }
     self::autoload();
     // assume core created!
     core::get_instance()->init();
     core::time_check('core', true, true);
     core::dprint('mount / from ' . self::get_root());
     core::dprint('booting done...');
     /* Functions registered with register_shutdown_function are called before deconstructors, at least as of PHP 5.2.1. 
        This contradicts an earlier commenter who claims that objects cannot be utilized in functions called from register_shutdown_function. */
     // register_shutdown_function(array($core, 'shutdown'));
     if (defined('TF_AUTORUN')) {
         core::get_instance()->main();
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:48,代码来源:loader.php


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