Path Problems in thinkphp. The path problem in thinkphp is written in the following statement publicfunctiontest () {echodirname (_ FILE _) in the method of a controller __). dirname (_ FILE __). br; path problem in echodirname () thinkphp
Write the following statement in the method in a controller.
Public function test ()
{
Echo 'dirname (_ FILE _) '. dirname (_ FILE __).'
';
Echo 'dirname () '. dirname ().'
';
Echo ''..'
';
// Echo '_ Public _'. _ Public __.'
';
Echo '';
Echo '_ FILE _'. _ FILE __.'
';
Echo '$ _ SERVER ["PHP_SELF"]'. $ _ SERVER ['php _ SELF '].'
';
Echo '$ _ SERVER ["SCRIPT_NAME"]'. $ _ SERVER ['script _ name'].'
';
Echo '$ _ SERVER ["SERVER_HOST"]'. $ _ SERVER ['server _ host'].'
';
Echo '$ _ SERVER ["SERVER_NAME"]'. $ _ SERVER ['server _ name'].'
';
Echo '$ _ SERVER ["SERVER_PROTOCOL"]'. $ _ SERVER ['server _ protocol'].'
';
Echo '$ _ SERVER ["SERVER_FILENAME"]'. $ _ SERVER ['script _ filename'].'
';
Echo dirname ($ _ SERVER ['script _ filename']);
Echo _ DIR __;
}
The result of browser access to this method is:
Dirname (_ FILE _) D: \ WWW \ tpapp \ Application \ Home \ Controller
Dirname ()\
/Tpapp
Banner1.jpg _ FILE _ D: \ WWW \ tpapp \ Application \ Home \ Controller \ ApiController. class. php
$ _ SERVER ["PHP_SELF"]/tpapp/index. php/home/api/test
$ _ SERVER ["SCRIPT_NAME"]/tpapp/index. php
$ _ SERVER ["SERVER_HOST"]
$ _ SERVER ["SERVER_NAME"] localhost
$ _ SERVER ["SERVER_PROTOCOL"] HTTP/1.1
$ _ SERVER ["SERVER_FILENAME"] D:/WWW/tpapp/index. php
Compile the following statement in the method of a controller: public function test () {echo dirname (_ FILE __). dirname (_ FILE __). br/; echo dirname ()...