Get current url path

How many examples I have not seen, all are essentially the same, and perform the same thing. Let’s take a look at one of them.


We have url and we get test, and in all examples the same

But how to make sure that we get not just test but with a slash /test?


You can get it with this piece of code:


Laravel Illuminate/Http/Request extends Symfony Request class which contains getPathInfo method.


Definition of that method you can find here.

Source: stackoverflow