CodeIgniter system flow, CodeIgniter process _php Tutorials

Source: Internet
Author: User
Tags benchmark php framework codeigniter zend framework

CodeIgniter system flow, CodeIgniter process


------------------------------------------------------------------------------------------------------

Enter frame entry file index.php =

Define the current environment for the app (for setting the error mode): Define (' Environment ', ' development ');

Set System file Directory name: $system _path = ' system ';

Set application file directory name: $application _folder = ' application '; can be customized

Defines the current file name constants: Define (' Self ', pathinfo (__file__, Pathinfo_basepath));

Define PHP file Suffix constants: Define (' EXT ', '. php '); This global constant is not recommended for use

Define system directory Path constants: Define (' BasePath ', str_replace (' \ \ ', '/', $system _path));

Define front-end controller file path constants: Define (' Fcpath ', str_replace (self, ', __file__));

Define system Directory Name constants: Define (' Sysdir ', trim (STRCHR (Trim (basepath, '/'), '/'), '/');

Define application directory Path constants: Define (' APPPATH ', BasePath. $application _folder. ' /');

Load boot file: require_once basepath. ' core/codeigniter.php ';

---------------------------------@ Black-eyed poet ---------------------------------

Enter system initialization File codeigniter.php =

Define (' ci_version ', ' 2.2.0 ');

Define (' Ci_core ', FALSE);

require (basepath. ' core/common.php '); Introduction of common function library files, including functions such as Load_class ()

Require (APPPATH. ' config/'). Environment. ' /constants.php '); Introduction of framework constants files, file and directory patterns & file stream patterns

Set_error_handler (' _exception_handler '); Define a custom error handler to log 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 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 base class, which allows you to mark points and calculate the time difference between them, and memory consumption can also be displayed

$BM->mark (' Total_execution_time_start ');

Benchmark mark, start of total execution time: $this->marker[' total_execution_time_start '] = Microtime ();
$BM->mark (' Loading_time:_base_classes_start ');

Datum mark, load time: $this->marker[' loading_time:_base_classes_start '] = Microtime ();

$EXT =& load_class (' Hooks ', ' core '); Instantiate the Hooks Hook class to provide a mechanism to extend the underlying system without stuffing

$EXT->_call_hook (' Pre_system '); Invokes the specified hook Pre_system

$CFG =& load_class (' Config ', ' core '); Instantiate the config configuration class, including methods for managing the configuration file

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 item is assigned and overridden by the variable
}

$UNI =& load_class (' Utf8 ', ' core '); Instantiate the Utf8 class to provide support for 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 should be based on the URI request, as well as the route set in the routing configuration file   

if (Isset ($routing))
{
$RTR->_set_overrides ($routing); Setting controller Overrides
}

$OUT =& load_class (' Output ', ' core '); Instantiate the output class, responsible for sending the final output to the browser

if ($EXT->_call_hook (' cache_override ') = = = = FALSE)
{
if ($OUT->_display_cache ($CFG, $URI) = = TRUE)
{
Exit Detects if there is a cache file, and if so, exits the current script directly
}
}

$SEC =& load_class (' Security ', ' core '); Instantiate Security class

$IN =& load_class (' Input ', ' core '); //Instantiate input input class for safe preprocessing of global input data  

$LANG =& load_class (' LANG ', ' core '); //Instantiate Lang language class

Require basepath. ' core/controller.php ';,//introduction of the Base controller class

function &get_instance ()
{
return Ci_controller::get_instance (); Returns a static variable $instance
}

if (file_exists (APPPATH. ' core/'. $CFG->config[' Subclass_prefix '). ' Controller.php '))
{
Require APPPATH. ' core/'. $CFG->config[' Subclass_prefix ']. ' Controller.php ';

Introducing a custom extended base controller class
}

if (! file_exists (APPPATH. ' controllers/'). $RTR->fetch_directory (). $RTR->fetch_class (). php '))
{
Show_error (' Unable to load your default controller. Please do sure the controller specified in your routes.php file is valid. ');
}

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

Loading the local controller

$BM->mark (' loading_time:_base_classes_end ');

Datum mark, Load time end: $this->marker[' loading_time:_base_classes_end '] = Microtime ();

Security checks

$EXT->_call_hook (' Pre_controller '); Call "Pre_controller" hook

$BM->mark (' controller_execution_time_ ('. $class. '/'. $method. ') _start '); Benchmark marker, controller execution time marker point

$CI = new $class (); Instantiating the request controller

$EXT->_call_hook (' post_controller_constructor '); Call "Post_controller_constructor" hook

method to invoke the request

$BM->mark (' controller_execution_time_ ('. $class. '/'. $method. ') _end '); Datum mark, controller execution time end marker point

$EXT->_call_hook (' Post_controller '); Call "Post_controller" hook

if ($EXT->_call_hook (' display_override ') = = = = FALSE)
{
$OUT->_display (); Send the final render 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 (); To close a database connection
}

-------------------------------------------------------------------------------------------------


CodeIgniter is ideal for developing large-scale projects with large volumes of traffic?

zend framework to spend a lot of time, not suitable for fast learning,
now domestic and foreign framework procedures are very much, such as SPEEDPHP,QEEPHP,CAKEPHP,TP, etc.
in accordance with the requirements of the landlord, Then only CI, personally feel better,
about CodeIgniter
CodeIgniter is a set of application development frameworks and toolkits for developers of PHP Web sites. She offers a rich set of standard libraries and simple interfaces and logical structures to enable developers to develop projects faster. Using CodeIgniter can reduce the amount of code written and devote your energies to the creative development of your project. The
CodeIgniter was developed by Ceorickellis of Ellislab Corporation. Its core framework is specifically written for this program, while many other class libraries, auxiliary functions, and subsystems come from the Content management system ExpressionEngine written by Rickellis and Paulburdick. Inspired by rubyonrails we created a PHP framework and introduced the concept of a framework into the general consciousness of the web community.
She is a small but powerful PHP framework, and as a simple and "elegant" toolkit, she can build a fully functional WEB application for PHP programmers. If you are a developer who has trouble sharing a host and worrying about deadlines for a customer, if you're tired of those silly, clumsy frameworks, then CodeIgniter is what you need if ...
* You want a small frame.
* You need great performance.
* You need a wide range of compatible PHP versions and configurations (e.g. PHP4) on standard hosts.
* You want a framework that is almost only 0 configured.
* You want a framework that doesn't need to use the command line.
* You want a framework that doesn't need to stick to restrictive coding rules.
* You are not interested in PEAR this large-scale integrated class library.
* You don't want to be forced to learn a template language (although you can choose the template parser you require).
* You don't like complexity, love simplicity.
* You need clear, complete documentation.

The most important is that the CI document is simple and easy to understand, haha
want to learn, you can go to CI China to see, you do not need me to paste the address it

 

CodeIgniter How to use

To tell the truth, I will not configure phpMyAdmin, Apache and other things under Ubuntu.
But is there a question that you are installing an Ubuntu virtual machine with CodeIgniter?
If so, you can actually run directly under Windows. The first thing you have to do is install a server locally, because PHP is a server to compile. Personally recommended XAMPP. After installation, make sure that all runs correctly, and then view the status on localhost.

All right, now, let's talk about CodeIgniter. CodeIgniter is the framework of PHP. If you have not learned PHP, you must first lay the foundation of PHP, and then to learn this. PHP has 3 ways to write code (so to understand, haha), regular, object-oriented, and MVC. CodeIgniter is a method of using MVC. MVC is also Model, view, and controller. The model is primarily used to invoke data in the database, and the controller can be understood as the middleman between model and view. It gets the value from the model and then passes it to view. View is the place to display, the language example: Html,css,javascript.

How do you use CodeIgniter?
After installing XAMPP, go to the installed folder to find Htdocs, and then create a folder on the line. After that, I threw him in.
(The highlighted folder is the one I created myself)

That's basically it.
In fact, the most important thing now is to lay the groundwork well. From the point of feeling that you do not understand these things completely, so sometimes lazy to answer similar questions. Hopefully you can find a solution.



http://www.bkjia.com/PHPjc/850756.html www.bkjia.com true http://www.bkjia.com/PHPjc/850756.html techarticle codeigniter system flow, CodeIgniter process----------------------------------------------------------------------------- -------------------------Enter the frame entry file index.php ...

  • 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.