Thinkphp four url access methods

Source: Internet
Author: User
I. What is MVCthinkphp's MVC mode is very flexible, even if only three or one of them can be run. M-Model write model class to operate on data V-View write html...

I. What is MVC thinkphp's MVC pattern is very flexible, even if only three or one of them can be run.

M-Model write model class to operate data

V-View: compile html files and display pages

C-Controller: write a class file (UserAction. class. php)

II. ThinkPHP MVC features // understanding

III. ThinkPHP MVC Directory // learn more

M project directory/application directory/Lib/Model

V project directory/application directory/Tpl

C project directory/application directory/Lib/Action

4. url access C // learn more

5. four url access methods // Highlights!

1. PATHINFO mode-focus on a lot of use later,If you want to pass multiple parameters, you can use the key 1/value 1/Key 2/value 2 method.

Http: // domain name/project name/entry file/module name/method name/key 1/value 1/Key 2/value 2

2. the normal mode is also called the rewrite mode.

Http: // domain name/project name/entry file? M = module name & a = method name & key 1 = value 1 & Key 2 = value 2

3. REWRITE mode, removing entry files for SEO optimization

Http: // domain name/project name/module name/method name/key 1/value 1/Key 2/value 2

4. compatibility mode

Http: // domain name/project name/entry file? S = module name/method name/key 1/value 1/Key 2/value 2

How to modify/in the PATHINFO address-in Home/Conf/config. php

'URL _ PATHINFO_DEPR '=>'-', // modify the RUL separator and replace the parameter part in the address bar-

Http: // domain name/project name/entry file/module name-method name-key 1-value 1-key 2-value 2

Enable the call mode in index. php to prevent file caching from affecting development in post-production mode

Define ('app _ debug', ture); // if it is set to true, files are cached if false.

Method for enabling REWRITE mode

Find rewrite_module modules/mod_rewrite.sl in httpd. conf and remove # From the restart service. Create. htaccess. php in the entry file. rewrite the file to remove index. php:

  1. RewriteEngine on
  2. RewriteCond % {REQUEST_FILENAME }! -D
  3. RewriteCond % {REQUEST_FILENAME }! -F
  4. RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
Related Article

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.