Home  >  Article  >  Backend Development  >  ThinkPHP Framework 1 Framework Construction

ThinkPHP Framework 1 Framework Construction

WBOY
WBOYOriginal
2016-07-25 08:46:221289browse

ThinkPHP Framework 1 Framework construction, friends in need can refer to it.


Set up the controller environment:

define('APP_PATH','./Application/') automatically creates a new Application folder and stores the environment in this folder.

require './ThinkPHP/ThinkPHP.php'; Run TP framework

Create controller:

1. Storage location: Controller folder

2. Naming convention: controller name + Controller.class.php

3. The class name and file name have the same name

4. Use Pascal nomenclature (big hump)

5. Try to be case sensitive,

6. THinkPHP defaults to UTF8 encoding

ThinkPHP’s four routing methods: 1.Normal mode http://localhost/index.php?m=Group&c=Controller&a=Method 2.pathinfo mode http://localhost/index.php/group/controller/method
3.rewrite mode 4.Compatibility mode http://localhost/index.php?S=/group/controller/method

ThinkPHP template:

1. Store it in the view folder.

2. A controller corresponds to a folder, and a method corresponds to a template


System constants __SELF__: current path __CONTROLLER__: current controller path __MODULE__: current grouping path __ACTIOM__: current method path __URL__ is equivalent to __CONTROLLER__ (but can only be used in templates, that is, it cannot be displayed in PHP files)











ThinkPHP


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn