PHP website instance analysis

Source: Internet
Author: User

<? Php
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 bkJia comments
$ GLOBALS [_ beginTime] = 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_4000Think_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 ));
// Encrypt the application name without the constant APP_NAME (bkJia)

 

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 (bkjia.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.