Home  >  Article  >  Backend Development  >  Path problem in thinkphp_PHP tutorial

Path problem in thinkphp_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:04:25889browse

Path problem in thinkphp

Write the following statement in a method in a controller
public function test()
{
echo 'dirname(__FILE__) ' . dirname(__FILE__) . '
';
echo 'dirname(__ROOT__) ' . dirname(__ROOT__) . '
';
echo '__ROOT__ ' . __ROOT__ . '
';
//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 the browser accessing this method is
dirname(__FILE__) D:WWWtpappApplicationHomeController
dirname(__ROOT__)
__ROOT__ /tpapp
banner1.jpg__FILE__ D:WWWtpappApplicationHomeControllerApiController.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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1073351.htmlTechArticlethink about the path problem in php. Write the following statement in a method in a controller public function test() { echo dirname(__FILE__) . dirname(__FILE__) . br/; echo dirname(__ROOT__)...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn