In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to configure the CI framework". In the daily operation, I believe many people have doubts about how to configure the CI framework. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about how to configure the CI framework. Next, please follow the editor to study!
Components of MVC:
Model (Model)
Represents your data structure. Generally speaking, your model class will include the functions of fetching, inserting, and updating your database.
View (View)
It is the information presented to the user. A view is usually a web page.
Controller (Controller)
Is an intermediary between models, views, and any other resources necessary to process HTTP requests, and generates web pages.
Give an example
For example, a batch of statistics can be represented by bar charts and pie charts respectively. The purpose of C is to ensure the synchronization of M and V. once M changes, V should be updated synchronously.
Characteristics of CI:
Simple: CodeIgniter is licensed under the Apache/BSD-style open source license, and you can use it if you want. Read the license agreement for more information (http://codeigniter.org.cn/)
Free: CodeIgniter is really lightweight. Our core system only needs some very small libraries, which is the opposite of those frameworks that need more resources.
MVC:CodeIgniter uses a model (Model)-view (View)-controller (Controllers) approach, which can better separate the presentation layer from the logical layer.
Pay special attention to:
Each controller is a class Class, and the function in each Class is a page. Well, this concept is very important!
Entry method:
Entry-- > Controller-- > method-- > Parameter
Localhost/index.php/welcome/index
Controller:
1. What exactly is a controller
In short, a controller is a class file
What the user accesses through URL is the specific member method in a controller class.
And let the code in this method do something.
2. How to create a controller
a. Create the folder\ application\ controllers
b. Class name must start with an uppercase letter
c. Inherit the core controller class CI_Controller
3. Creation method
a. Is to create a member method function ()
b. The index method is accessed by default
4. How does URL pass parameters to the method
The formal parameters passed into the method sequentially after the method segment
Configure CI:
1. Download the latest version of the CI framework from CI's official website. The latest version is version 2.13.
two。 After unzipping, there are three folders:
Configuration files to be used in application development, Model,VIew,Control files, etc.
System CI framework source code
User_guide user's Manual
Interface file of index.php CI
3. Create a folder ci in the root directory and copy application, system and index.php to ci. You can write whatever you want with this folder.
4. Then visit: localhost/ci actual access path-- > localhost/ci/index.php/welcome/index
In this way, it can be used. The specific instructions are as follows:
1. The entry method of its access is mentioned above.
Entry-- > Controller-- > method-- > Parameter
two。 It is mainly that the welcome.php file under the controllers folder under application accesses the welcome_message.php file under views.
3. How is it accessed?
There is a routing file routes.php under the config folder
The routing path file welcome is configured
So you can see Welcome to Codelgniter!
4. Create business logic files in models and view files in views
The copy code is as follows:
/ * Note that the class name (uppercase, also the file name) cannot be the same as the method name, otherwise an error will be reported. For an Index like this, if there is an index method below, an error will occur * /
Class Index extends CI_Controller {
Function index () {
}
}
At this point, the study on "how to configure the CI framework" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.