search
HomeBackend DevelopmentPHP TutorialCodeIgniter system process, codeigniter process_PHP tutorial

CodeIgniter system process, codeigniter process

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

Enter the framework entry file index.php =>

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

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

Set the application file directory name: $application_folder = 'application'; //Can be customized

Define the current file name constant: define('SELF', pathinfo(__FILE__, PATHINFO_BASEPATH));

Define PHP file suffix constant: define('EXT', '.php'); //This global constant is not recommended to be used

Define system directory path constants: define('BASEPATH', str_replace('\', '/', $system_path));

Define the front-end controller file path constant: define('FCPATH', str_replace(SELF, '', __FILE__));

Define system directory name constants: define('SYSDIR', trim(strchr(trim(BASEPATH, '/'), '/'), '/'));

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

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

---------------------------------@黑eyedpoet-- ----------------------------------

Enter the system initialization file CodeIgniter.php =>

define('CI_VERSION', '2.2.0');

define('CI_CORE', FALSE);

require(BASEPATH.'core/Common.php');  //Introducing public function library files, including functions such as load_class()

require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); //Introducing framework constant files, file and directory mode & file stream mode

set_error_handler('_exception_handler'); //Define 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 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 benchmark class. This class allows you to mark points and calculate the time difference between them. Memory consumption can also be displayed

$BM->mark('total_execution_time_start');

//Benchmark mark, total execution time starts: $this->marker['total_execution_time_start'] = microtime();
$BM->mark('loading_time:_base_classes_start');

//Benchmark mark, loading 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 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 methods 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 configuration items are assigned and rewritten through variables
}

$UNI =& load_class('Utf8', 'core'); //Instantiate Utf8 class to provide support for UTF-8 environment

$URI =& load_class('URI', 'core'); //Instantiate URI class, parse URI and determine routing

$RTR =& load_class('Router', 'core'); //Instantiate Router routing class, parse URI and determine routing

, and the route set in the routing configuration file


if (isset($routing))
{
 $RTR->_set_overrides($routing); //Set controller overrides
}
$OUT =& load_class('Output', 'core'); //Instantiate the Output 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; //Check whether there is a cache file, if so, exit the current script directly

}

}

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

$IN ​​=& load_class('Input', 'core');   //Instantiate the Input input class and preprocess the global input data for safety  

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

require BASEPATH.'core/Controller.php';, //Introducing the basic controller class

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

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

//Introduce custom extension 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 local controller

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

//Benchmark mark, the end of loading time: $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

Call the requested method

$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
}

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

Is codeigniter suitable for developing large-scale and high-traffic projects?

Zend Framework takes a lot of time and is not suitable for quick learning.
There are many framework programs at home and abroad, such as speedphp, qeephp, cakephp, TP, etc.
According to the poster’s request, then there is only CI , I personally think it’s pretty good,
About CodeIgniter
CodeIgniter is a set of application development frameworks and toolkits for PHP website developers. It provides a rich set of standard libraries and simple interfaces and logical structures, aiming to enable developers to develop projects more quickly. Use CodeIgniter to reduce the amount of code you write and focus your energy on the creative development of your projects.
CodeIgniter was developed by Rick Ellis, CEO of Ellislab. Its core framework is specially written for this program, while many other class libraries, auxiliary functions and subsystems come from the content management system ExpressionEngine written by Rick Ellis and Paul Burdick. Inspiration from Ruby on Rails inspired us to create a PHP framework and bring the concept of frameworks into the general consciousness of the web community.
She is a small but powerful PHP framework. As a simple and "elegant" toolkit, she can build fully functional web applications for PHP programmers. If you are a developer who shares your hosting and is worried about client deadlines, if you are tired of those stupid and clunky frameworks, then CodeIgniter is what you need if...
* You Want a compact frame.
* You need great performance.
* You need broad compatibility with various PHP versions and configurations on standard hosts (e.g. PHP4).
* You want a framework that requires almost 0 configuration.
* You want a framework that doesn't require the command line.
* You want a framework that doesn't have to adhere to restrictive coding rules.
* You are not interested in large-scale integration libraries like PEAR.
* You don't want to be forced to learn a template language (although you can choose the template parser you ask for).
* You don’t like complexity and love simplicity.
* You need clear, complete documentation.

The most important thing is that CI’s documentation is simple, rich and easy to understand, haha
If you want to learn, you can go to CI China and have a look, you don’t need me to post the address for you

How to use codeigniter

To be honest, I don’t know how to configure phpmyadmin, apache and other things under ubuntu.
But I have a question, did you install the Ubuntu virtual machine because you want to use codeigniter?
If this is the case, you can actually run it directly under windows. The first thing you have to do is install a server locally, because php is compiled by the server. Personally recommend xampp. After installation, make sure everything is running normally, and then check the status on localhost.

Okay, now let’s talk about codeigniter. codeigniter is a PHP framework. If you have not learned PHP, you must first lay the foundation of PHP before learning this. PHP has three ways of writing code (you can understand it this way, haha), regular, object-oriented, and MVC. Codeigniter uses 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 middleman between model and view. It will get the value from the model and pass it to the view. View is the place used for display. Language examples: html, css, javascript.

How to use codeigniter?
After installing xampp, go to the installed folder to find htdocs, and then create a folder. Then just throw him in like this.
(The highlighted folder was created by me)

That’s basically it.
In fact, the most important thing now is to lay a good foundation. It seems from the question that you don't understand these things at all, so sometimes you are too lazy to answer questions like this. Hope you can find a solution.

CodeIgniter system process, codeigniter process_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/850756.htmlTechArticleCodeIgniter system process, codeigniter process----------------- -------------------------------------------------- ---------------------------------- Enter the framework entry file index.php...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Email: Step-by-Step Sending GuidePHP Email: Step-by-Step Sending GuideMay 09, 2025 am 12:14 AM

PHPisusedforsendingemailsduetoitsintegrationwithservermailservicesandexternalSMTPproviders,automatingnotificationsandmarketingcampaigns.1)SetupyourPHPenvironmentwithawebserverandPHP,ensuringthemailfunctionisenabled.2)UseabasicscriptwithPHP'smailfunct

How to Send Email via PHP: Examples & CodeHow to Send Email via PHP: Examples & CodeMay 09, 2025 am 12:13 AM

The best way to send emails is to use the PHPMailer library. 1) Using the mail() function is simple but unreliable, which may cause emails to enter spam or cannot be delivered. 2) PHPMailer provides better control and reliability, and supports HTML mail, attachments and SMTP authentication. 3) Make sure SMTP settings are configured correctly and encryption (such as STARTTLS or SSL/TLS) is used to enhance security. 4) For large amounts of emails, consider using a mail queue system to optimize performance.

Advanced PHP Email: Custom Headers & FeaturesAdvanced PHP Email: Custom Headers & FeaturesMay 09, 2025 am 12:13 AM

CustomheadersandadvancedfeaturesinPHPemailenhancefunctionalityandreliability.1)Customheadersaddmetadatafortrackingandcategorization.2)HTMLemailsallowformattingandinteractivity.3)AttachmentscanbesentusinglibrarieslikePHPMailer.4)SMTPauthenticationimpr

Guide to Sending Emails with PHP & SMTPGuide to Sending Emails with PHP & SMTPMay 09, 2025 am 12:06 AM

Sending mail using PHP and SMTP can be achieved through the PHPMailer library. 1) Install and configure PHPMailer, 2) Set SMTP server details, 3) Define the email content, 4) Send emails and handle errors. Use this method to ensure the reliability and security of emails.

What is the best way to send an email using PHP?What is the best way to send an email using PHP?May 08, 2025 am 12:21 AM

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

Best Practices for Dependency Injection in PHPBest Practices for Dependency Injection in PHPMay 08, 2025 am 12:21 AM

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHP performance tuning tips and tricksPHP performance tuning tips and tricksMay 08, 2025 am 12:20 AM

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

PHP Email Security: Best Practices for Sending EmailsPHP Email Security: Best Practices for Sending EmailsMay 08, 2025 am 12:16 AM

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version