83270/how-to-get-current-url-path-in-php
I need to get the path from the URL of the current request. For example, if the current URL is:
"http://www.example.com/example/test/hi.php?randomvariable=1"
I would want this:
"/example/test/hi.php?randomvariable=1"
Hello @kartik,
Use
$_SERVER['REQUEST_URI'].
The URI which was given in order to access this page; for instance, '/index.html'.
Hope it helps!! Thank you!!
Hello @kartik, You can use the URL facade ...READ MORE
Hello @kartik, Use SERVER_NAME. echo $_SERVER['SERVER_NAME'] ...READ MORE
Hello, Try this code: if (!function_exists('getallheaders')) { ...READ MORE
Hello, Here is a code sample of a good ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
Hello @kartik, Have a look at $_SERVER['REQUEST_URI'], i.e. $actual_link = ...READ MORE
Hello @kartik, $_GET is not a function or language ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.