Home >Backend Development >PHP Tutorial >php-file path problem
1. Background
Today when I was developing a sample website, I encountered a troublesome thing, which was the file path problem of Php. I was very confused. I finally gained some knowledge by checking relevant information!
2. The specific examples are as follows
(1) The URL address of this test is as follows: getallifo.php file under the app folder
http://localhost:8081/GoodsServers/app/getAllIfo.php
$pa= $_SERVER['DOCUMENT_ROOT']; echo $pa; # D:/Wamp/wamp/www/ echo '<br>'; echo __FILE__; # D:\Wamp\wamp\www\GoodsServers\app\getAllIfo.php echo '<br>'; echo dirname(__FILE__); # D:\Wamp\wamp\www\GoodsServers\app echo '<br>'; echo dirname(dirname(__FILE__)); # D:\Wamp\wamp\www\GoodsServers echo '<br>'; echo basename(__FILE__); # getAllIfo.php Exit;
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above has introduced the php-file path problem, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.