Hello!
If I am in the page: http://www.abc.com/cat/page1.php
How do I get the "page1.php" in a variable please?
🙂
$PHP_SELF
I believe that also includes the /, so you may need to use str_replace to strip the forward slash if you don't want it.
$script = str_replace("/", "", $PHP_SELF);
Cgraz
Hi! 🙂
I have tested now, actually it gets:
catpage1.php
If possible, I would like to only get the page1.php please
Doesn't for me, but if that's the case, then do this:
$script = strrchr($PHP_SELF,"/"); $script = str_replace("/", "", $script);
$page = split("/",$_SERVER["PHP_SELF"] $page = $page[count($page)];
Works fine.
You are a nice person cgraz.
Thanks.