我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

获取PHP文件的文件名

I'm trying to fetch the filename of my php file. Out of curiosity i was wondering if there are any alternative way of doing this besides.

echo "<br/>".basename($_SERVER['PHP_SELF']);

Php has a magic constant that return the file path : __FILE__

if you only want the file name, use basename(__FILE__)

The advantage is that it will work even for a php script called via CLI and not executed by a web server / cgi.

See more here

近期文章

  • sqlserver数据库怎么安装bcp工具?
  • 微软实时语音转文本使用js实现
  • vue table分页序号错乱
  • scanf中空白符的使用,郝斌说CPrimerPlus上讲了,我不知道具体在哪里
  • VS code 代码行数不一致问题
  • fraggle攻击报文是啥 linux怎么查看某端口的http服务谁进来过做过啥
  • 请问这个程序的运行规程是怎样的?求解s=f(aa,5); 是代表什么。
  • rabbitmq死信队列消息离奇失踪
  • python访问tensorflow ssl证书鉴证失败
  • 在PHP中插入HTML代码
  • 锂电池用于消防电源产品的充放电问题
  • 为什么程序运行报错了,求解答
  • 用c语言给分数开根号
  • 在一个软件运行时,除他之外的其他软件会无法访问网络
  • React+Desgin框架实现组件绑定数据源数据独立
  • C# 如何监控bat打开的exe的控制台输出?
  • mybatis初学者 为什么提示找不到这个xml文件呢
  • 研究生毕业论文还能使用yolov5吗?
  • 如何用eeglab截取一段脑电数据呢?
  • 为什么A12不能是低电平

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华