CI (codeigniter) framework Configuration _php Tutorial

Source: Internet
Author: User
Part of MVC:

Models (model)
Represents your data structure. In general, your model class will include the ability to remove, insert, and update your database data.
Views (view)
Is the information displayed to the user. A view is usually a Web page.
Controllers (Controller)
Is the mediation between the model, the view, and any other resources necessary to process the HTTP request, and generates the Web page.
Example
For example, a batch of statistical data can be represented by a histogram, pie chart, respectively. C exists to ensure the synchronization of M and V, and once M is changed, V should be updated synchronously.

Features of CI:

Simple: CodeIgniter is licensed by the Apache/bsd-style Open source license and can be used if you wish. Read the license agreement to get more information (http://codeigniter.org.cn/)
Free: CodeIgniter is really lightweight. Our core system requires only a few very small libraries, which are the exact opposite of those that require more resources.
Mvc:codeigniter uses the model-view-Controller (Controllers) approach to better decouple the presentation layer from the logical layer.

Special attention:

Each controller is a class, the function in each class is a page, well, this concept is very important!

Entry method:

Entrance--Controller--and method--parameters
Localhost/index.php/welcome/index

Controller:

1, in the end what is the controller
In short, a controller is a class file
What a user accesses through a URL is a specific member method in a controller class
And by the code in this method to do some operations

2. How to create a controller
A. Creating a folder \application\controllers
B. The class name must start with an uppercase letter
C. Inheriting the core controller class Ci_controller

3. How to create
A. is to create a member method function ()
B. The index method is accessed by default

4, url how to pass parameters to the method
form parameters in sequential pass-through methods after method segments

Configure CI:

1. Download the latest version of the CI Framework on the CI website and the current version of the 2.13 edition
2. After decompression, there are three folders:
Application development to use the configuration file, Model,view,control and other files ...
System CI Framework Source code
User_guide User Manual
index.php CI's interface file
3. root directory to create a folder CI, the application, system and index.php copied to the CI, this folder, you can freely write
4. Then visit: Localhost/ci actual access path--Localhost/ci/index.php/welcome/index



This can be used, the specific instructions are as follows:

1. The entry method on which it accesses is described above
Entrance--Controller--and method--parameters

2. The main is the application under the Controllers folder welcome.php file access to the welcome_message.php file under views

3. How is it accessed?
There is a routing file under the Config folder routes.php
The routing path file is configured welcome
So you can see Welcome to codelgniter!

4. Create a business logic file in models, create a view file in views

Copy the Code code as follows:
/* Note that the class name (uppercase and file name) cannot be the same as the method name, otherwise it will error, such as index, there is an index method below, error */
Class Index extends ci_controller{
function index () {

}
}

http://www.bkjia.com/PHPjc/781409.html www.bkjia.com true http://www.bkjia.com/PHPjc/781409.html techarticle part of MVC: The model represents your data structure. In general, your model class will include the ability to remove, insert, and update your database data. View is an exhibition ...

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