模型名称不能用下划线
namespace app\admin\model;
use think\Model;
class Article extends Model
{
protected $resultSetType = 'collection';
protected $table='tp_article';
public function articleimg()
{
return $this->hasMany('articleimg','aid','id');
}
//
}
$list = Articles::with('articleimg')->where('id',50)->select()->toArray();
dump($list);die;
网友评论