PHP 面向对象开发的一些问题
如下代码是一个类中的方法:
public function getHead(){
$map = array(
'A.state'=>array('eq',1),
'A.recommend'=>array('eq',1)
);
$prefix = C('DB_PREFIX');
$data = $this->Table("{$prefix}auction as A")->
join("{$prefix}accessory as AC ON A.goods_pic = AC.id")->
join("{$prefix}accessory as ACC ON A.agopic = ACC.id")->
field('A.*,AC.path,ACC.path as agopath')->where($map)->
find();
return $data;
}
在下面这段代码里
$this->Table("....."),在任何地方都找不到定义的Table( )方法!为什么?求指点!
$data = $this->Table("{$prefix}auction as A")->
join("{$prefix}accessory as AC ON A.goods_pic = AC.id")->
join("{$prefix}accessory as ACC ON A.agopic = ACC.id")->
field('A.*,AC.path,ACC.path as agopath')->where($map)->
find();
------解决方案--------------------你的这个方法所在的类是继承与一个数据库基类的(也可能就是基类)
如果你没有在这个类(或他的父类)中找到 table 方法的定义,那么就一定定义了一个 __call 方法