Brother even new thinkphp video tutorial 2.ThinkPHP 3.1.2 MVC mode and URL access

Source: Internet
Author: User

#
# thinkphp 3 MVC mode and URL access
#
Lecturer: Zhao Tun
Weibo: Http://weibo.com/zhaotongzheng


This lesson outlines:
I. What is MVC//understanding
M-model writing Model classes to manipulate data
V-view Writing HTML files, page rendering
C-controller Writing class files (UserAction.class.php)
Second, the MVC features of thinkphp//understanding
Third, thinkphp of the MVC corresponding Directory//understanding
M project directory/application directory/lib/model
V project directory/application directory/TPL
C project directory/application directory/lib/action
Iv. URL Access c//understanding
Five, URL 4 ways to access//focus!
1.PATHINFO Mode--KEY!!!!!!
HTTP//project name/Portal File/Module name/method name/Key 1/value 1/Key 2/value 2
2. Normal mode
HTTP//Name/project/portal file? m= Module name &a= method name & key 1= value 1& key 2= value 2
3.REWRITE mode
HTTP//project name/Module name/method name/Key 1/value 1/Key 2/value 2
4. Compatibility mode
HTTP//Name/project name/entry file? S= Module Name/method name/Key 1/value 1/Key 2/value 2

#
# I join part
#

VI. Configuration Item//conf/config.php

' Url_pathinfo_depr ' = '-',//Modify the delimiter of the URL

Seven, open rewrite function//apache the main directory/conf/httpd.conf

Search rewrite, remove the front #

Then create a new. Htaccess content entry in the thinkphp root directory

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
</ifmodule

Eight, open the debug mode

Entry file index.php input define (' Add_debug ', true);

Brother even new thinkphp video tutorial 2.ThinkPHP 3.1.2 MVC mode and URL access

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.