如何在Laravel 5中访问刀片中的URL段? [英] How to access URL segment(s) in blade in Laravel 5?
本文介绍了如何在Laravel 5中访问刀片中的URL段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网址:http://localhost:8888/projects/oop/2
我要访问第一段-> projects
I want to access the first segment --> projects
我尝试过
<?php echo $segment1 = Request::segment(1); ?>
刷新页面时,我的视图中看不到任何内容.
I see nothing print out in my view when I refresh my page.
任何帮助/建议将不胜感激
Any helps / suggestions will be much appreciated
推荐答案
尝试一下
{{ Request::segment(1) }}
这篇关于如何在Laravel 5中访问刀片中的URL段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文