Reputation: 5364
How Do I find the name of the page title from $_SERVER['php_self']?
$_SERVER['php_self']
Let's say the $_SERVER shows my page like this: /application/mysite/signup.php.
$_SERVER
/application/mysite/signup.php
How can I select the page title signup?
signup
Upvotes: 2
Views: 180
Reputation: 12525
You can use basename:
basename
echo basename($_SERVER['php_self'], '.php');
or pathinfo:
pathinfo
$pathInfo = pathinfo($_SERVER['php_self']); echo $pathInfo['filename'];
Upvotes: 11