php - How to get last word of the URL (Laravel 5.1) -
this question has answer here:
i want last word of url:
http://localhost:8888/articles/tags/europa
how make in laravel ? {{url::current()}}
i'm getting full url. have tried {{url::current().split('/').last}}
error: function split() deprecated
try , use preg_split()
instead
example:
$var = 'http://localhost:8888/articles/tags/europa'; $var = preg_split("/\//", 'http://localhost:8888/articles/tags/europa'); array_pop($var ); //removes last
update
i can't delete because accepted answer please see josh088's answer
Comments
Post a Comment