当前位置:网站首页>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对象负责输出客户端或者浏览器响。
边栏推荐
- Common architectures of IO streams
- Beginners use Minio
- Go language foundation ----- 13 ----- file
- experiment.........
- Go language foundation ----- 15 ----- reflection
- Common operations of JSP
- Comparison of advantages and disadvantages between most complete SQL and NoSQL
- Traversal in Lucene
- 技术干货|利用昇思MindSpore复现ICCV2021 Best Paper Swin Transformer
- Leetcode 198: house raiding
猜你喜欢
Lucene hnsw merge optimization
Go language foundation ----- 02 ----- basic data types and operators
Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ----- 15 ----- reflection
How long is the fastest time you can develop data API? One minute is enough for me
技术干货|昇思MindSpore NLP模型迁移之Roberta ——情感分析任务
Go language foundation ----- 07 ----- method
Shengsi mindspire is upgraded again, the ultimate innovation of deep scientific computing
Es writing fragment process
【MySQL 12】MySQL 8.0.18 重新初始化
随机推荐
Industrial resilience
SQL create temporary table
技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验
[mindspire paper presentation] summary of training skills in AAAI long tail problem
Hello world of vertx
Technical dry goods Shengsi mindspire operator parallel + heterogeneous parallel, enabling 32 card training 242 billion parameter model
项目经验分享:基于昇思MindSpore实现手写汉字识别
Implementation of breadth first in aggregation in ES
Segment read
FileInputStream and fileoutputstream
Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition
Robots protocol
Chapter VI - Containers
How long is the fastest time you can develop data API? One minute is enough for me
Industrial resilience
experiment.........
技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!
PgSQL converts string to double type (to_number())
Common methods of file class
【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结