还有类型,一定要和文件名一样
pk是表的主键,table是表名
<?PHP
namespace app\common\model\automatic;
use app\common\model\CommonModel;
class IntegralModel extends CommonModel{
protected $pk = 'id';
protected $table = 'move_integral';
}
在控制器使用:使用use将模型引入进来,在进行实例化,进行模型操作
<?PHP
namespace app\miniapp\controller\automatic;
use app\miniapp\controller\Common;
use app\common\model\automatic\IntegralModel;
class Integral extends Common
{
public function index()
{
$integral = new IntegralModel();
$list = $integral->order('id desc')->select();
$this->assign('list',$list);
return $this->fetch();
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。