1、首先把本地项目加载进来。

2、在index控制器里新建一个方法view.

3、为这个方法添加一个备注。

4、写上视图查询的语句。
Db::view('user','name,age')
->view('score','score','user.id=score.id')
->where('user.status=1')
->select();
print_r($result);

5、将这个视图查询赋予给变量$result.

6、将这个查询打印出来。

7、打开浏览器,输入地址进行测试。

时间:2026-02-14 17:56:39
1、首先把本地项目加载进来。

2、在index控制器里新建一个方法view.

3、为这个方法添加一个备注。

4、写上视图查询的语句。
Db::view('user','name,age')
->view('score','score','user.id=score.id')
->where('user.status=1')
->select();
print_r($result);

5、将这个视图查询赋予给变量$result.

6、将这个查询打印出来。

7、打开浏览器,输入地址进行测试。
