CodeIgniter system process and codeigniter Process

Source: Internet
Author: User

CodeIgniter system process and codeigniter Process

Bytes ------------------------------------------------------------------------------------------------------

Go to the Framework entry file index. php =>

Define the current ENVIRONMENT of the application (used to set the error mode): define ('enable', 'development ');

Set the system file directory name: $ system_path = 'system ';

Set the application file directory name: $ application_folder = 'application'; // customizable

Defines the current FILE name constant: define ('self ', pathinfo (_ FILE __, PATHINFO_BASEPATH ));

Define the php file suffix constant: define ('text', '. php'); // This global constant is not recommended.

Define the system directory path constant: define ('basepath', str_replace ('\', '/', $ system_path ));

Define the front-end controller FILE path constant: define ('fcpath ', str_replace (SELF, '', _ FILE __));

Define the system directory name constant: define ('sysdir', trim (strchr (trim (BASEPATH ,'/'),'/'),'/'));

Define the application directory path constant: define ('apppath', BASEPATH. $ application_folder .'/');

Load the boot file: require_once BASEPATH. 'core/CodeIgniter. php ';

--------------------------------- @ Blackeye poet <www. chenwei. ws> ---------------------------------

Enter the system initialization file CodeIgniter. php =>

Define ('Ci _ version', '2. 2.0 ');

 

Define ('Ci _ core', FALSE );

 

Require (BASEPATH. 'core/Common. php'); // introduce the public function library file, including load_class () and other functions

 

Require (APPPATH. 'config/'. ENVIRONMENT.'/constants. php'); // introduce the framework constant file, file and directory mode & file stream mode

 

Set_error_handler ('_ exception_handler'); // defines a custom error handler to record PHP errors

If (! Is_php ('5. 3 '))
{
@ Set_magic_quotes_runtime (0); // Kill magic quotes
}

 

If (isset ($ assign_to_config ['subclass _ prefix']) AND $ assign_to_config ['subclass _ prefix']! = '')

// Set the subclass prefix
{
Get_config (array ('subclass _ prefix' => $ assign_to_config ['subclass _ prefix']);
}

 

If (function_exists ("set_time_limit") = true and @ ini_get ("safe_mode") = 0)

// Set a free script execution time limit
{
@ Set_time_limit (300 );
}

 

$ BM = & load_class ('benchmark', 'core ');

// Instantiate the Benchmark class, which enables you to mark points and calculate the time difference between them, and display memory consumption.

$ BM-> mark ('total _ execution_time_start ');

// Benchmark mark, total execution start time: $ this-> marker ['total _ execution_time_start '] = microtime ();
$ BM-> mark ('loading _ time: _ base_classes_start ');

// Benchmark tag, loading time: $ this-> marker ['loading _ time: _ base_classes_start '] = microtime ();

 

$ EXT = & load_class ('hooks', 'core'); // instantiate the Hooks hook class, providing a mechanism to expand the basic system without stacking

$ EXT-> _ call_hook ('pre _ system'); // call the specified hook pre_system

 

$ CFG = & load_class ('config', 'core'); // instantiate the Config configuration class, including the method for managing Configuration Files

If (isset ($ assign_to_config ))
{
$ CFG-> _ assign_to_config ($ assign_to_config );

// Call the _ assign_to_config method in Config. php to ensure that the configuration items are allocated and overwritten through variables.
}

 

$ UNI = & load_class ('utf8', 'core'); // instantiate the Utf8 class to support the UTF-8 Environment

 

$ URI = & load_class ('uri ', 'core'); // instantiate the URI class, parse the URI and determine the route

 

$ RTR = & load_class ('router ', 'core'); // instantiate the Router routing class, parse the URI and determine the route

$ RTR-> _ set_routing (); // This function determines what is based on the URI request and the route set in the route configuration file

If (isset ($ routing ))
{
$ RTR-> _ set_overrides ($ routing); // set the Controller Overwrite
}

 

$ OUT = & load_class ('output', 'core'); // instantiate the Output class and send the final Output to the browser.

If ($ EXT-> _ call_hook ('cache _ override') === FALSE)
{
If ($ OUT-> _ display_cache ($ CFG, $ URI) = TRUE)
{
Exit; // check whether a cached file exists. If yes, exit the current script directly.
}
}

 

$ SEC = & load_class ('security', 'core'); // instantiate the Security class

 

$ IN = & load_class ('input', 'core'); // instantiate the Input class, to secure global Input data preprocessing

 

$ LANG = & load_class ('lang ', 'core'); // instantiate the Lang language class

 

Require BASEPATH. 'core/Controller. php';, // introduce the basic Controller class

Function & get_instance ()
{
Return CI_Controller: get_instance (); // return the static variable $ instance
}

If (file_exists (APPPATH. 'core/'. $ CFG-> config ['subclass _ prefix']. 'controller. php '))
{
Require APPPATH. 'core/'. $ CFG-> config ['subclass _ prefix']. 'controller. php ';

// Introduce the custom extended basic controller class
}

 

If (! File_exists (APPPATH. 'controllers/'. $ RTR-> fetch_directory (). $ RTR-> fetch_class ().'. php '))
{
Show_error ('unable to load your default controller. Please make sure the controller specified in your Routes. php file is valid .');
}

Include (APPPATH. 'controllers/'. $ RTR-> fetch_directory (). $ RTR-> fetch_class ().'. php ');

// Load the local Controller

 

$ BM-> mark ('loading _ time: _ base_classes_end ');

// Benchmark mark. The loading time ends: $ this-> marker ['loading _ time: _ base_classes_end '] = microtime ();

 

Security check

 

$ EXT-> _ call_hook ('pre _ controller'); // call "pre_controller" hook

 

$ BM-> mark ('controller _ execution_time _('. $ class. '/'. $ method. ') _ start'); // benchmark mark, controller execution time mark point

$ CI = new $ class (); // instantiate the request Controller

 

$ EXT-> _ call_hook ('Post _ controller_constructor '); // call "post_controller_constructor" hook

 

Method of calling the request

 

$ BM-> mark ('controller _ execution_time _('. $ class. '/'. $ method. ') _ end'); // benchmark mark, controller execution time end mark point

 

$ EXT-> _ call_hook ('Post _ controller'); // call "post_controller" hook

 

If ($ EXT-> _ call_hook ('display _ override') === FALSE)
{
$ OUT-> _ display (); // send the final rendering output to the browser
}

 

$ EXT-> _ call_hook ('Post _ system'); // call "post_system" hook

 

If (class_exists ('Ci _ db') AND isset ($ CI-> DB ))
{
$ CI-> db-> close (); // close the database connection
}

Bytes -------------------------------------------------------------------------------------------------


Codeigniter is suitable for developing large projects with high traffic volumes?

Zend Framework takes a lot of time and is not suitable for quick learning,
Currently, there are many frameworks at home and abroad, such as speedphp, qeephp, cakephp, and TP.
According to the requirements of the landlord, only CI is available. I personally think it is quite good,
About CodeIgniter
CodeIgniter is an application development framework and toolkit for PHP website developers. She provides a rich set of standard libraries and simple interfaces and logical structures to help developers develop projects more quickly. CodeIgniter can reduce the amount of code writing and devote your energy to the creative development of projects.
CodeIgniter is developed by CEORickEllis of Ellislab. Its core framework is specially compiled for this program, while many other class libraries, auxiliary functions and subsystems come from the content management system ExpressionEngine compiled by RickEllis and PaulBurdick. Inspired by RubyonRails, we have created a PHP framework and introduced the concept of the Framework into the general consciousness of the network community.
She is a small but powerful PHP framework. As a simple and "elegant" toolkit, she can build functional Web applications for PHP programmers. If you are a developer who shares a host with others and is worried about the deadline the customer requires, and if you are tired of those stupid frameworks, CodeIgniter is what you need, if...
* You want a small framework.
* You need outstanding performance.
* You need to be widely compatible with various PHP versions and configurations (such as PHP4) on standard hosts ).
* You want a framework with almost zero configuration.
* You want a framework that does not require the use of command lines.
* You want a framework that does not require adherence to restrictive encoding rules.
* You are not interested in PEAR large-scale integrated class libraries.
* You do not want to be forced to learn a template language (although you can select the template parser you want ).
* You do not like complexity, but love simplicity.
* You need clear and complete documents.

The most important thing is that CI documents are simple, rich, and easy to understand. Haha
If you want to learn, you can go to CI China to see it. I don't need to post an address for you.


How can codeigniter be used?

To be honest, I will not configure phpmyadmin, apache, and other things in ubuntu.
But you have a question: Do you want to install ubuntu virtual machine because of codeigniter?
In this case, you can run it directly in windows. First, you must install a server locally, because php is compiled by the server. I personally recommend xampp. After the installation, make sure all operations are normal, and then check the status of localhost.

Now let's talk about codeigniter. Codeigniter is the framework of php. If you have never learned php, you must first lay the foundation of php and then learn this. Php has three code writing methods (you can understand this, haha), regular expressions, object-oriented methods, and MVC. Codeigniter adopts the mvc method. MVC is Model, view, and controller. Model is mainly used to call data in the database, and Controller can be understood as the intermediary between model and view. It gets the value from the model and passes it to the view. View is used for display. Example: html, css, and javascript.

How to Use codeigniter?
After installing xampp, go to the installed folder and find htdocs, and create a folder. Then he will be thrown in.
(The highlighted folder is created by myself)

This is basically the case.
In fact, the most important thing now is to lay the foundation well. From the question, you feel that you have no idea about these things, so sometimes you are very lazy to answer questions like this. Hope you can find the solution.



Related Article

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.