index.php

View Code
  1 <?php

  2 

  3 /**

  4  * The directory in which your application specific resources are located.

  5  * The application directory must contain the bootstrap.php file.

  6  *

  7  * @link http://kohanaframework.org/guide/about.install#application

  8  */

  9 $application = 'application';

 10 

 11 /**

 12  * The directory in which your modules are located.

 13  *

 14  * @link http://kohanaframework.org/guide/about.install#modules

 15  */

 16 $modules = 'modules';

 17 

 18 /**

 19  * The directory in which the Kohana resources are located. The system

 20  * directory must contain the classes/kohana.php file.

 21  *

 22  * @link http://kohanaframework.org/guide/about.install#system

 23  */

 24 $system = 'system';

 25 

 26 /**

 27  * The default extension of resource files. If you change this, all resources

 28  * must be renamed to use the new extension.

 29  *

 30  * @link http://kohanaframework.org/guide/about.install#ext

 31  */

 32 define('EXT', '.php');

 33 

 34 /**

 35  * Set the PHP error reporting level. If you set this in php.ini, you remove this.

 36  * @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting

 37  *

 38  * When developing your application, it is highly recommended to enable notices

 39  * and strict warnings. Enable them by using: E_ALL | E_STRICT

 40  *

 41  * In a production environment, it is safe to ignore notices and strict warnings.

 42  * Disable them by using: E_ALL ^ E_NOTICE

 43  *

 44  * When using a legacy application with PHP >= 5.3, it is recommended to disable

 45  * deprecated notices. Disable with: E_ALL & ~E_DEPRECATED

 46  */

 47 error_reporting(E_ALL | E_STRICT);

 48 

 49 /**

 50  * End of standard configuration! Changing any of the code below should only be

 51  * attempted by those with a working knowledge of Kohana internals.

 52  *

 53  * @link http://kohanaframework.org/guide/using.configuration

 54  */

 55 

 56 // Set the full path to the docroot

 57 define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);

 58 

 59 // Make the application relative to the docroot, for symlink'd index.php

 60 if ( ! is_dir($application) AND is_dir(DOCROOT.$application))

 61     $application = DOCROOT.$application;

 62 

 63 // Make the modules relative to the docroot, for symlink'd index.php

 64 if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))

 65     $modules = DOCROOT.$modules;

 66 

 67 // Make the system relative to the docroot, for symlink'd index.php

 68 if ( ! is_dir($system) AND is_dir(DOCROOT.$system))

 69     $system = DOCROOT.$system;

 70 

 71 // Define the absolute paths for configured directories

 72 define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);

 73 define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);

 74 define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);

 75 

 76 // Clean up the configuration vars

 77 unset($application, $modules, $system);

 78 

 79 if (file_exists('install'.EXT))

 80 {

 81     // Load the installation check

 82     return include 'install'.EXT;

 83 }

 84 

 85 /**

 86  * Define the start time of the application, used for profiling.

 87  */

 88 if ( ! defined('KOHANA_START_TIME'))

 89 {

 90     define('KOHANA_START_TIME', microtime(TRUE));

 91 }

 92 

 93 /**

 94  * Define the memory usage at the start of the application, used for profiling.

 95  */

 96 if ( ! defined('KOHANA_START_MEMORY'))

 97 {

 98     define('KOHANA_START_MEMORY', memory_get_usage());

 99 }

100 

101 // Bootstrap the application

102 require APPPATH.'bootstrap'.EXT;

103 

104 if (PHP_SAPI == 'cli') // Try and load minion

105 {

106     class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');

107     set_exception_handler(array('Minion_Exception', 'handler'));

108 

109     Minion_Task::factory(Minion_CLI::options())->execute();

110 }

111 else

112 {

113     /**

114      * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].

115      * If no source is specified, the URI will be automatically detected.

116      */

117     echo Request::factory(TRUE, array(), FALSE)

118         ->execute()

119         ->send_headers(TRUE)

120         ->body();

121 }

122 

123 // 自己添加的,显示所有加载的文件

124 echo '<br />';

125 $included_files = get_included_files();

126 foreach($included_files as $file_name)

127 {

128     echo $file_name.'<br />';

129 }

 

你可能感兴趣的:(index)