The CI framework process of PHP is basically familiar with the CI framework. it is a fast development framework of PHP. I am currently using PHP in the background language of the company's projects, because I am doing front-end development, the page data needs to be filled with php, so I started to understand this framework and learned something about php and database. This article first introduces the CI framework. I use the CI2.0 framework.
1. download the compressed package from the codeIgniter website.
Note: the download method 2.0 or 3.0 may be different. So you need to read the corresponding manual. Manual URL: http://codeigniter.org.cn/docs.
2. download the package locally and decompress it. After pressurization, the folder is used as follows:
3. put the main application and system folders of the CI framework under the folder you want to put.
4. we know that Apache is required to run php for parsing. Apache is a WEB server software. Installing Apache software on your own is very troublesome, so you can use an integrated software, phpStudy. this software has a mysql database and can be used without configuration.
5. enable phpStudy and right-click phpStudy-open the configuration file-vhosts-conf file. Open the vhosts-conf file, configure domain name access, as shown in, save and restart phpStudy.
6. open the host file for configuration. As shown in
After all the configuration is complete, enter the domain name + index. php in the address bar of the browser to access the site. for example, if my website is http://www.test.com/index.php, then you can see that the ciframe has been successfully used.
7. roles of folders in the application folder:
8. if the file you want to create is not stored in the CI application directory, you can copy all the files in the application directory to the new directory you created, however, the created directory must be at the same level as the application directory.
9. if you want to hide index. php in the url, perform the following operations:
By default, URLs in CodeIgniter are designed to be friendly to search engines and humans. CodeIgniter usesSegment-basedMethod:
Example.com/news/article/my_article
Note:The URL in string format is optional and is described as follows.
URI segment
According to the model-view-controller mode, the URL segment is generally expressed as follows:
Bytes
- The first section indicates calling the controller.Class.
- The second part indicatesFunctionOr method.
- The third and more segments represent the parameters passed to the controller, such as ID or other variables.
Functions in the URI class and URL helper functions can make your URI easier to work. In addition, you can use the URI routing feature to redirect your URL for greater flexibility.