场景
一个学生对应一张学生证,一张学生证对应一个学生,查询某个学生的信息及学生证编号。
数据模型
- think_student 学生表
id | student_name |
---|---|
1 | 柯南 |
2 | 元太 |
3 | 步美 |
4 | 小哀 |
5 | 光彦 |
- think_student_card 学生证表
id | student_card_number | student_id |
---|---|---|
1 | 80199809011901 | 1 |
2 | 80199809011902 | 2 |
3 | 80199809011903 | 3 |
4 | 80199809011904 | 4 |
5 | 80199809011905 | 5 |
代码
- 创建 StudentModel.class.php 内容如下:
1 | <?php |
- 创建 StudentCardModel.class.php 内容如下:
1 | <?php |
- 创建 TestController.class.php 内容如下:
1 | <?php |
查询
1 | { |