开发者

How can I print name of corrent page using php?

How can I print name of corrent page using php ?

echo $corrent_page_name;

R开发者_Go百科esult should be :

index.php


$corrent_page_name = basename($_SERVER['SCRIPT_FILENAME']);

See the PHP manual for $_SERVER and basename for more information.

You could also use __FILE__ such as:

$corrent_page_name = basename(__FILE__);


$current_page_name = $_SERVER['PHP_SELF'];

Also, you can use this to include any GET variables in the URL:

$current_page_name = $_SERVER['REQUEST_URI']

EDIT: Sorry. I misunderstood the question. I'll leave this here anyway for future reference.


$current_page_name = end(explode("/",$_SERVER["SCRIPT_FILENAME"]));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜