0
说的确切目录我跑如何获得一个脚本
http://mymaindomain.com/helloworld/somescript.php
我想http://mymaindomain.com/helloworld/
我该怎么办呢?
说的确切目录我跑如何获得一个脚本
http://mymaindomain.com/helloworld/somescript.php
我想http://mymaindomain.com/helloworld/
我该怎么办呢?
你能检查我的答案吗?
https://stackoverflow.com/a/41407858/3821823
你也可以这样定义常量变量:
const BASE_URL = 'http://mymaindomain.com/helloworld/';
// or
define('BASE_URL', 'http://mymaindomain.com/helloworld/');
echo BASE_URL;
不是机器内部的目录,但面对公众的目录。所以不是/ root/htdocs/public_html/helloworld /更像http://domainname.com/helloworld/ –
可能重复的[获取当前脚本的绝对路径](http://stackoverflow.com/questions/4645082/get-绝对路径当前脚本) –
http://php.net/manual/en/reserved.variables.server.php – leaf