首页 > 开发 > ThinkPHP > 正文

ThinkPHP Model 与 Action 用法

2020-10-12 21:16:35
字体:
来源:转载
供稿:网友

一直听说ThinkPHP可以使用Model调取数据库,今日才会用Model,在Action中使用D方法条用Model中函数.

D("Model名字")->函数名.

例:D("User")->getList();

调用  UserModel.php 文件中 的 function getLiser() 函数,在Model下的函数使用 $this 代表实例化当前 Model名字的表,Model下文件一般以  数据库表名+Model.php 命名

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选