我有一个 Model.class.php 和一个 Bag.class.php,Bag 类扩展了 Model 类。
但是当我尝试调用 Bag.class.php 中定义的函数时,它会显示一个致命错误“调用未定义函数 fill_entity() in”
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.