This article analyzes four url access methods of thinkphp through examples. Share it with everyone for your reference. The specific analysis is as follows:
1. What is MVC
thinkphp’s MVC model is very flexible and can run even with only three and one.
M-Model writes model classes to operate on data
V -View writes html files and renders the page
C-Controller writes class file (UserAction.class.php)
2. MVC features of ThinkPHP (Easy understanding)
3. Directory corresponding to ThinkPHP’s MVC (Easy understanding)
M project directory/application directory/Lib/Model
V Project Directory/Application Directory/Tpl
C Project Directory/Application Directory/Lib/Action
4. URL access C (simple understanding)
5. 4 ways to access URL (This is the key point!!)
1.PATHINFO mode --The key point is used a lot later. If you want to pass multiple parameters, you can use the key 1/value 1/key 2/value 2 method
2. Normal mode is also called rewrite mode
3.REWRITE rewriting mode, remove the entry file to facilitate SEO optimization
4. Compatibility mode
How to modify / in the PATHINFO address to - in Home/Conf/config.php
Enable calling mode in index.php to prevent file caching from affecting development in post-production mode
How to enable REWRITE mode
Look for rewrite_module modules/mod_rewrite.sl in httpd.conf, remove the # and restart the service. Create a new .htaccess.php under the entry file. Rewriting the file means removing index.php:
I hope this article will be helpful to everyone’s ThinkPHP framework programming.