首先:有三个数据表
现在用命令行建立它们的模型
php think make:model admin/class
php think make:model index/teacher
php think make:model index/student
用法:
$list = classs::all();foreach($list as $key=>$value){$list[$key]['student'] -----学生(一个班级对应学生多个)$list[$key]['teacher'] ------老师(一个班级对应学生一个)}--------------------------------------------------------------------------------------------- $list = teacherdb::all();foreach($list as $key=>$value){$list[$key][‘class’] -----班级(一个老师对应学生一个) }
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注!
相关推荐:
php使用azure storage blob上传文件
tp5判断手机端和pc端
以上就是thinkphp中model的使用方法的详细内容。
