TP5 关联查询 多表查询

控制器

			  $schoolstation_rs=Db::name('school')
			
			    ->field('a.id,a.title,b.sid,b.price') 
			    ->alias('a')
				->join('schoolstation b','a.id = b.sid')
			    ->where('a.pid',$rs['sid'])
			    ->where('a.flid',2)
			    ->select();
				$this->assign('schoolstation_rs',$schoolstation_rs);

模板

										  
{volist name="schoolstation_rs" id="schoolstation"}
{/volist}



官方教程:

https://www.kancloud.cn/manual/thinkphp5/118077

https://www.kancloud.cn/manual/thinkphp5/118083

你可能感兴趣的:(thinkphp5)