函数名. 例:D("User")->getList(); 调用 UserModel.php …">

1.ThinkPHP Model 与 Action 用法

一直听说ThinkPHP可以使用Model调取数据库,今日才会用Model,在Action中使用D方法条用Model中函数.
D(“Model名字”)->函数名.
例:D(“User”)->getList();
调用 UserModel.php 文件中 的 function getLiser() 函数,在Model下的函数使用 $this 代表实例化当前 Model名字的表,Model下文件一般以 数据库表名+Model.php 命名

作者 铁血 汉子 2019年10月21日
2024/04/19/11:27:45pm 2019/10/21/3:54:09
0 1048