tp5总结(一)

https://github.com/ABCDdouyaer/tp5-1

1.下载composer 安装框架 也可以安装包或者git安装

 composer create-project topthink/think tp5 --prefer-dist

2.可以更改localhost  C:\Windows\System32\drivers\etc中的hosts里面更改

3.MVC模型(M为model为数据模型【操作数据库相关数据】;V为view为视图模型;C为controller为控制器【控制网站逻辑和流程】)

4.跨控制器调用方法

   4-1:调用当前模块下的控制器方法(四种方法)

           eg:http://ww:7070/tp5/public/index/user/diaoyong1

   4-2:跨模块调用控制器方法(四种方法) 

           eg:http://ww:7070/tp5/public/index/user/diaoyong2

   4-2:调用当前控制器方法(四种方法)

           eg:http://ww:7070/tp5/public/index/user/diaoyong3

 5.TP的运行机制

  【入口文件(public/index.php)】——>【加载框架的引导目录 thinkphp/start.php】——>【加载框架的基础引导文件thinkphp/base.php】——>【运行应用thinkphp/library/think/App.php下的run方法】

 6.配置文件[尽量使用数组进行配置]

读取配置文件(三种方法) eg:http://ww:7070/tp5/public/index/peizhi/peizhi1

  • 惯例配置:thinkphp/convention.php    注意:不要去修改
  • 应用配置:application/config.php
  • 扩展配置:就是对配置文件进行分目录的管理 【默认:application/datebase和application/extra】

读取扩展配置:eg:http://ww:7070/tp5/public/index/peizhi/peizhiall

自定义扩展配置:【application/extra/】eg:http://ww:7070/tp5/public/index/peizhi/zidingyi

  • 场景配置:在公司和家里等地方设置不同的配置,比如数据库,通过更改config里面的应用配置里面的app_status来设置不同的配置,默认为原始配置,可以将home配置写入home.php通过设置app_status=>home来设置
  • 模块配置:每一个模块都有自己特定的配置文件 eg:后台模块配置 http://ww:7070/tp5/public/index/peizhi/model
  • 动态配置:eg:http://ww:7070/tp5/public/index/peizhi/dongtai
posted @ 2017-12-22 15:43  爱编程的douyaer  阅读(1721)  评论(0编辑  收藏  举报
Fork me on MaYun