Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to echo __FILE__ name without path. I just want to name of page for example: index.php

Tags:

People also ask

What is __ FILE __ in PHP?

__FILE__ is simply the name of the current file. realpath(dirname(__FILE__)) gets the name of the directory that the file is in -- in essence, the directory that the app is installed in. And @ is PHP's extremely silly way of suppressing errors.

How do I find the path of a PHP file?

php $path = "C:\\test_folder\\folder2\\folder4"; $sub_folder = scandir($path); $num = count($sub_folder); for ($i = 2; $i < $num; $i++) { if(is_file($path.

How do I echo a directory in PHP?

PHP dirname() Functionecho dirname("c:/testweb/home. php", 2) . "<br />"; echo dirname("/testweb/home.


echo __FILE__;

gives me: C:\EasyPHP-DevServer-13.1VC9\data\localweb\projects\FOLDERNAME\index.php

I just want to get file name without its path. I want to get index.php on its own.

Any ideas?