当前位置: 代码迷 >> PHP >> 得到脚本名字如何弄啊
  详细解决方案

得到脚本名字如何弄啊

热度:624   发布时间:2012-02-03 22:02:47.0
得到脚本名字怎么弄啊?
假如我当前脚本是:index.php
我要得到index
怎么弄?


------解决方案--------------------
basename();
看看手册
------解决方案--------------------
$str = "index.php ";
$str = strsub($str,0,-4);//从首位开始取到倒数第四位,也就是取出.php之前的东西!
echo $str;
又或者用字符串分割!不过我觉得那麻烦!
------解决方案--------------------
$_SERVER[ 'SCRIPT_FILENAME ']
------解决方案--------------------
basename($_SELF, '.php ')
------解决方案--------------------
同上
  相关解决方案