I need to find the name of the file that I included without the GET parameters.
e.g .: if the current URL is http://www.mysite.com/folder/file.php?a=b&c=d , I want to return the .php file
what i found:
basename($_SERVER['REQUEST_URI'])
which returns:
file.php?a=b&c=d
in my case: I use the name of the file in the form in the section for my cart, so every time you click the "reduce the number of products" button, it adds the GET parameters of the form (productId and action) to the end of the URL: file.php = B &? c = q a = b &? c = q a = b &? c = q a = b & c = q ...
I know I can just explode or something like that on '?'
$file = explode("?", basename($_SERVER['REQUEST_URI']))
and use the first part of the array, but I seem to be recalling something, but can't find the code again.
PHP, .
,