Heim  >  Artikel  >  Backend-Entwicklung  >  ThinkPHP框架一 框架搭建

ThinkPHP框架一 框架搭建

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

ThinkPHP框架一 框架搭建,有需要的朋友可以参考下。


搭建控制器环境:

define('APP_PATH','./Application/') 自动新建Application文件夹,并把环境存放在此文件夹下。

require './ThinkPHP/ThinkPHP.php'; 运行TP框架

创建控制器:

1、存放位置:Controller文件夹中

2、命名规范:控制器的名称+Controller.class.php

3、类名和文件名同名

4、用帕斯卡命名法(大驼峰)

5、尽量区分大小写,

6、THinkPHP默认全部是UTF8编码

ThinkPHP的四种路由方式: 1.普通模式 http://localhost/index.php?m=分组&c=控制器&a=方法 2.pathinfo模式 http://localhost/index.php/分组/控制器/方法
3.rewrite模式 4.兼容模式 http://localhost/index.php?S=/分组/控制器/方法

ThinkPHP模板:

1、存放在view文件夹下。

2、一个控制器对应一个文件夹,一个方法对应一个模板


系统常量 __SELF__:当前路径 __CONTROLLER__:当前控制器路径 __MODULE__:当前分组路径 __ACTIOM__:当前方法路径 __URL__相当于__CONTROLLER__(但是只能在模板里面使用 也就是说 不能再,PHP文件里面显示出来)











ThinkPHP


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn