PHP website instance analysis

Source: Internet
Author: User
? Phpif (version_compare (PHP_VERSION, '5. 000000', '') {// version earlier than 5.0.0die ('thinkphp1. * require_oncePHP5.0! '); // Prompt and terminate} // record start time PHP100 comments $ GLOBALS [' _ inintime']

If (version_compare (PHP_VERSION, '5. 0.0 ',' <') {// version earlier than 5.0.0
Die ('thinkphp 1. * require_once PHP> 5.0! '); // Prompt and terminate
}
// Record start time PHP100 comments
$ GLOBALS ['_ inintime'] = microtime (TRUE );

// The global variable TRUE indicates the addition of seconds and microseconds.

 

// ThinkPHP system directory definition
If (! Defined ('think _ path') define ('think _ path', dirname (_ FILE __));

// The value of THINK_PATH is d: \ www_4000 \ Think_path

 

// Dirname (_ FILE _); the directory name on the top of the FILE is obtained.
// Dirname (_ FILE _); the directory name of the FILE layer is obtained.

 

If (! Defined ('app _ name') define ('app _ name', md5 (THINK_PATH ));
// If no constant APP_NAME exists, encrypt the application name (PHP100)

 

If (! Defined ('app _ path') define ('app _ path', dirname (THINK_PATH). '/'. APP_NAME );


If (! Defined ('runtime _ path') define ('runtime _ path', APP_PATH. '/Temp /');

// Runtime path

 

If (file_exists (RUNTIME_PATH .'~ Runtime. php ')){
// This file is included in the runtime path, and the core cache file of the framework is loaded.
// If the core file is modified, delete the cache (PHP100.com)
Require_once RUNTIME_PATH .'~ Runtime. php ';
} Else {
// Load the system definition file
Require_once THINK_PATH. "/Common/defines. php ";
// System function library
Require_once THINK_PATH. "/Common/functions. php ";
// Load the function file required for compilation
Require_once THINK_PATH. "/Common/runtime. php ";
// The Project Directory structure is automatically created if it does not exist during the first run check.
If (! File_exists (RUNTIME_PATH )){
// Create a project directory structure
BuildAppDir ();
}

// Load the ThinkPHP base class
Import ("Think. Core. Base ");


// Load exception handling class
Import ("Think. Exception. ThinkException ");


// Load the log class
Import ("Think. Util. Log ");


// Load the Think core class
Import ("Think. Core. App ");


Import ("Think. Core. Action ");


Import ("Think. Core. Model ");


Import ("Think. Core. View ");


// Whether to generate the core cache
$ Cache = (! Defined ('cache _ runtime') | CACHE_RUNTIME = true );
If ($ cache ){
If (defined ('strip _ RUNTIME_SPACE ') & STRIP_RUNTIME_SPACE = false ){
$ Fun = 'File _ get_contents ';
} Else {
$ Fun = 'php _ strip_whitespace ';
}
// Generate the cache of the core file and remove the file blank to reduce the size
$ Content = $ fun (THINK_PATH. '/Common/defines. php ');
$ Content. = $ fun (THINK_PATH. '/Common/functions. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Core/Base. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Exception/ThinkException. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Util/Log. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Core/App. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Core/Action. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Core/Model. class. php ');
$ Content. = $ fun (THINK_PATH. '/Lib/Think/Core/View. class. php ');
}
If (version_compare (PHP_VERSION, '5. 2.0 ',' <')){
// Load compatible functions
Require_once THINK_PATH. '/Common/compat. php ';
If ($ cache ){
$ Content. = $ fun (THINK_PATH. '/Common/compat. php ');
}
}
If ($ cache ){
File_put_contents (RUNTIME_PATH .'~ Runtime. php', $ content); // write a string to a file
Unset ($ content); // destroy $ content
}
}
// Record the file loading time
$ GLOBALS ['_ loadtime'] = microtime (TRUE );
?>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.