0
我有以下路線,如何在laravel 5中獲取url分段數?
http:/localhost/seg1/seg2/seg3
如何從上面的網址,以獲取Request::segment
計數?
預期的結果是,
$totalSegsCount = 3
感謝,
我有以下路線,如何在laravel 5中獲取url分段數?
http:/localhost/seg1/seg2/seg3
如何從上面的網址,以獲取Request::segment
計數?
預期的結果是,
$totalSegsCount = 3
感謝,
Request對象有一個返回all segments功能,放置在一個count()
讓你尋求數:
$totalSegsCount = count(Request::segments());
aaahh它正在工作thx –
然後請將此答案標記爲已接受^ – Quezler