4,249
社区成员




public function goodsPage(){
$table_goods=M('goods');
$goods_id=I('param.id');
$info_where['id']=$goods_id;
$goods_info=$table_goods->where($info_where)->field('id,name,price,type,img,detail_img1,detail_img2,detail_img3,number,supply')->select();
$this->assign('info',$goods_info);
$this->display();
}
public function goodsPage(){
$goods=D('Goods');
$goods_info = $goods->foo();
$this->assign('info',$goods_info);
$this->display();
}
在model文件夹下建立一个 GoodsModel.class.php 文件
代码如下:
<?php
class GoodsModel extends Model{
public function foo(){
$table_goods=M('goods');
$goods_id=I('param.id');
$info_where['id']=$goods_id;
$goods_info=$table_goods->where($info_where)->field('id,name,price,type,img,detail_img1,detail_img2,detail_img3,number,supply')->select();
return $goods_info;
}
}
public function goodsPage(){
$table_goods=M('goods');
$goods_id=I('param.id');
$info_where['id']=$goods_id;
$goods_info=$table_goods->where($info_where)->field('id,name,price,type,img,detail_img1,detail_img2,detail_img3,number,supply')->select();
$this->assign('info',$goods_info);
$this->display();
}
[/quote]对滴,标准的mvc是这样。