当前位置:网站首页>tp3.2和tp5.0的区别
tp3.2和tp5.0的区别
2022-07-03 07:41:00 【.周周】
1.单字母函数的弃用,使用助手函数
5.0助手函数和3.2版本的单字母函数对比如下:
| 获取和设置配置参数 | 抛出异常处理 | 调试时间和内存占用 | 获取语言变量值 | 获取输入数据 支持默认值和过滤 | 实例化Model | 实例化数据库类 | 实例化控制器 | Url生成 | 缓存管理 | |
| 3.2版本 | C | E | G | L | I | D | M | A | U | S |
| 5.0版本 | config | exception | debug | lang | input | model | db | controller | url | cache |
2.控制器模板输出的方法
3.2
$this->display()
5.0
return view('index/hello');
或
return $this->fetch('index/hello');
3.控制器命名
应用类库的命名空间统一为app(可修改)
控制器的类名默认不带Controller后缀,可以配置开启controller_suffix参数启用控制器类后缀
3.2
IndexController.class.php
5.0
Index.php
4.模型
命名,模型类的后缀不带Model
D('User')->where(['name'=>'thinkphp'])->find();
model('User')->where('name','thinkphp')->find();
5.数据库操作写法
M('User')->where(['name'=>'thinkphp'])->find();
db('User')->where('name','thinkphp')->find();
5.废弃系统常量
5.0中废弃的系统常量
REQUEST_METHOD、IS_GET、IS_POST、IS_PUT、IS_DELETE、IS_AJAX、__EXT__、COMMON_MODULE、MODULE_NAME、CONTROLLER_NAME、ACTION_NAME、APP_NAMESPACE、APP_DEBUG、MODULE_PATH等
6.getField方法
5.0中使用value和column方法
value获取某条记录中某个字段的值;
column获取某列的值;
7.请求对象和响应对象
5.0新增了请求对象Request和响应对象Response,Request统一处理请求和获取请求信息,Response对象负责输出客户端或者浏览器响。
边栏推荐
- 項目經驗分享:實現一個昇思MindSpore 圖層 IR 融合優化 pass
- Go language foundation ----- 11 ----- regular expression
- How long is the fastest time you can develop data API? One minute is enough for me
- Vertx multi vertical shared data
- Reconnaissance et détection d'images - Notes
- Use of other streams
- Unified handling and interception of exception exceptions of vertx
- Go language foundation ----- 08 ----- interface
- Go language foundation ----- 13 ----- file
- OSPF protocol summary
猜你喜欢

Technical dry goods Shengsi mindspire innovation model EPP mvsnet high-precision and efficient 3D reconstruction

Go language foundation ----- 18 ----- collaboration security, mutex lock, read-write lock, anonymous lock, sync Once

Introduction of buffer flow

技术干货|百行代码写BERT,昇思MindSpore能力大赏

Go language foundation ----- 15 ----- reflection

Es writing fragment process

Go language foundation ----- 16 ----- goroutine, GPM model

【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机

技术干货 | AlphaFold/ RoseTTAFold开源复现(2)—AlphaFold流程分析和训练构建

技术干货|AI框架动静态图统一的思考
随机推荐
Image recognition and detection -- Notes
Go language foundation ----- 10 ----- string related operations (operation function, string conversion)
华为S5700交换机初始化和配置SSH和TELNET远程登录方法
Analysis of the problems of the 7th Blue Bridge Cup single chip microcomputer provincial competition
项目经验分享:基于昇思MindSpore实现手写汉字识别
Pgadmin 4 v6.11 release, PostgreSQL open source graphical management tool
【踩坑系列】mysql 修改root密码失败
Leetcode 213: looting II
Lombok -- simplify code
Use of other streams
Analysis of the problems of the 11th Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
VMware network mode - bridge, host only, NAT network
【MySQL 14】使用DBeaver工具远程备份及恢复MySQL数据库(Linux 环境)
Lombok cooperates with @slf4j and logback to realize logging
技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型
The babbage industrial policy forum
Iterm2设置
Go language foundation ----- 07 ----- method