zoukankan      html  css  js  c++  java
  • application\bootstrap.php引导文件

    View Code
      1 <?php defined('SYSPATH') or die('No direct script access.');
      2 
      3 // -- Environment setup --------------------------------------------------------
      4 
      5 // Load the core Kohana class
      6 require SYSPATH.'classes/Kohana/Core'.EXT;
      7 
      8 if (is_file(APPPATH.'classes/Kohana'.EXT))
      9 {
     10     // Application extends the core
     11     require APPPATH.'classes/Kohana'.EXT;
     12 }
     13 else
     14 {
     15     // Load empty core extension
     16     require SYSPATH.'classes/Kohana'.EXT;
     17 }
     18 
     19 /**
     20  * Set the default time zone.
     21  *
     22  * @link http://kohanaframework.org/guide/using.configuration
     23  * @link http://www.php.net/manual/timezones
     24  */
     25 date_default_timezone_set('America/Chicago');
     26 
     27 /**
     28  * Set the default locale.
     29  *
     30  * @link http://kohanaframework.org/guide/using.configuration
     31  * @link http://www.php.net/manual/function.setlocale
     32  */
     33 setlocale(LC_ALL, 'en_US.utf-8');
     34 
     35 /**
     36  * Enable the Kohana auto-loader.
     37  *
     38  * @link http://kohanaframework.org/guide/using.autoloading
     39  * @link http://www.php.net/manual/function.spl-autoload-register
     40  */
     41 spl_autoload_register(array('Kohana', 'auto_load'));
     42 
     43 /**
     44  * Optionally, you can enable a compatibility auto-loader for use with
     45  * older modules that have not been updated for PSR-0.
     46  *
     47  * It is recommended to not enable this unless absolutely necessary.
     48  */
     49 //spl_autoload_register(array('Kohana', 'auto_load_lowercase'));
     50 
     51 /**
     52  * Enable the Kohana auto-loader for unserialization.
     53  *
     54  * @link http://www.php.net/manual/function.spl-autoload-call
     55  * @link http://www.php.net/manual/var.configuration#unserialize-callback-func
     56  */
     57 ini_set('unserialize_callback_func', 'spl_autoload_call');
     58 
     59 // -- Configuration and initialization -----------------------------------------
     60 
     61 /**
     62  * Set the default language
     63  */
     64 I18n::lang('en-us');
     65 
     66 /**
     67  * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
     68  *
     69  * Note: If you supply an invalid environment name, a PHP warning will be thrown
     70  * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
     71  */
     72 if (isset($_SERVER['KOHANA_ENV']))
     73 {
     74     Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV']));
     75 }
     76 
     77 /**
     78  * Initialize Kohana, setting the default options.
     79  *
     80  * The following options are available:
     81  *
     82  * - string   base_url    path, and optionally domain, of your application   NULL
     83  * - string   index_file  name of your index file, usually "index.php"       index.php
     84  * - string   charset     internal character set used for input and output   utf-8
     85  * - string   cache_dir   set the internal cache directory                   APPPATH/cache
     86  * - integer  cache_life  lifetime, in seconds, of items cached              60
     87  * - boolean  errors      enable or disable error handling                   TRUE
     88  * - boolean  profile     enable or disable internal profiling               TRUE
     89  * - boolean  caching     enable or disable internal caching                 FALSE
     90  * - boolean  expose      set the X-Powered-By header                        FALSE
     91  */
     92 Kohana::init(array(
     93     'base_url'   => '/kohana/',
     94 ));
     95 
     96 /**
     97  * Attach the file write to logging. Multiple writers are supported.
     98  */
     99 Kohana::$log->attach(new Log_File(APPPATH.'logs'));
    100 
    101 /**
    102  * Attach a file reader to config. Multiple readers are supported.
    103  */
    104 Kohana::$config->attach(new Config_File);
    105 
    106 /**
    107  * Enable modules. Modules are referenced by a relative or absolute path.
    108  */
    109 Kohana::modules(array(
    110     // 'auth'       => MODPATH.'auth',       // Basic authentication
    111     // 'cache'      => MODPATH.'cache',      // Caching with multiple backends
    112     // 'codebench'  => MODPATH.'codebench',  // Benchmarking tool
    113     // 'database'   => MODPATH.'database',   // Database access
    114     // 'image'      => MODPATH.'image',      // Image manipulation
    115     // 'minion'     => MODPATH.'minion',     // CLI Tasks
    116     // 'orm'        => MODPATH.'orm',        // Object Relationship Mapping
    117     // 'unittest'   => MODPATH.'unittest',   // Unit testing
    118     // 'userguide'  => MODPATH.'userguide',  // User guide and API documentation
    119     ));
    120 
    121 /**
    122  * Set the routes. Each route must have a minimum of a name, a URI and a set of
    123  * defaults for the URI.
    124  */
    125 Route::set('default', '(<controller>(/<action>(/<id>)))')
    126     ->defaults(array(
    127         'controller' => 'welcome',
    128         'action'     => 'index',
    129     ));
  • 相关阅读:
    Eclipse报错:pom.xml web.xml is missing and <fainOnMissingWebXml> is set to true
    WebStrom之React Native之HelloWord 【Windows】
    React Native报错:This error often happens when you’re running the packager (local dev server) from a wrong folder
    'adb' 不是内部或外部命令,也不是可运行的程序 或批处理文件。【Windows】
    Spring Boot项目部署到tomcat启动失败404
    Codeforces Beta Round #51 D. Beautiful numbers 数位DP
    UOJ 34 FFT
    POJ 2773 容斥原理
    HTPJ 1268 GCD
    HDOJ 2082 生成函数
  • 原文地址:https://www.cnblogs.com/daizhuacai/p/2952440.html
Copyright © 2011-2022 走看看