我有一个Model.class.php和一个Bag.class.php,Bag类扩展了Model类。php方法undefined error
但是当我尝试调用Bag.class.php定义的函数,它表明“在调用未定义功能fill_entity()”一个致命的错误
bag.class.php:
class Bag extends Model{
public function __construct($table_name){
$this->table_name = $table_name;
}
public function fill_entity($row){
$this->id = $row['bagID'];
$this->name = $row['bagName'];
$this->price = $row['bagPrice'];
$this->url = $row['bagURL'];
$this->img_url = $row['bagImgURL'];
$this->mall_id = $row['mallID'];
$this->brand_id = $row['brandID'];
}
这里是我的PHP网页,我调用这个函数:
$bag = new Bag($bagtype);
$bag.fill_entity($row); <---- error on this line.
使用' - >'替代'''来引用函数。 – 2012-07-23 02:39:04
哦,狗屎。多谢你们。 – MrROY 2012-07-23 02:45:01
...因为你写的是有效的PHP。它尝试连接一个不存在的全局函数'fill_entity()'和变量'$ bag'的输出。 – 2012-07-23 02:45:31