laravel路由参数
程序员文章站
2022-07-12 14:57:24
...
页面上需要跳转,跳转的时候需要传参,有以下两种方式传参:
1、url方法:
代码:
<a href="{{ url('student.teacher_detail',['teacher_info_id'=>$data['teacherId'],'foo'=>'bar']) }}">
<img src="{{ $data['teacherHeadImage'] or '' }}" alt="">
</a>
生成的链接:
http://192.168.0.136:83/student.teacher_detail/12/bar
结果:
2、route方法:
代码:
<a href="{{ route('student.teacher_detail',['teacher_info_id'=>$data['teacherId'],'foo'=>'bar']) }}">
<img src="{{ $data['teacherHeadImage'] or '' }}" alt="">
</a>
生成的链接:
http://192.168.0.136:83/student/teacherDetail?teacher_info_id=12&foo=bar
结果:
上一篇: Week2 实验