亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - TP5 many-to-many association query reports an error. Can you help me find out where the problem is?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-07-05 10:46:01
0
1
1064

1. I have just come into contact with TP5, and I am confused about the correlation model in the manual. I am here to ask for help~~ I hope you can get some answers. First post the error screenshot

#2. The model code is as follows

namespace app\index\model;
use think\Model;
class User extends Model{
    public function group(){
        //用戶表 belongsToMany 用戶組表(關(guān)聯(lián)模型,中間表,關(guān)聯(lián)id1,關(guān)聯(lián)id2)
                return $this->belongsToMany('Group','auth_group_access','uid','group_id');
        }
}

3. The controller code is as follows

namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use app\index\model\User as Usermodel;

class User extends Controller{
     //用戶列表
    public function index(){
        $user = new Usermodel();
        $data = $user->group;
        p($data);die;
        $this->assign('v',$data);
        return $this -> fetch();
    }
}
PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級(jí)講師

reply all(1)
Ty80

The id attribute does not exist. See how $notFound is obtained. Is there any missing parameters?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template