close
EX: /var/www/include/abc.php
取得檔案名稱與路徑 /var/www/include/abc.php
__FILE__;
取得檔案名稱 test.php
basename(__FILE__);
取得檔案名稱(不含附檔名) test
basename(__FILE__, '.php');
取得此目錄前的完整路徑 /var/www/include
dirname(__FILE__);
取得上層目錄前的完整路徑 /var/www
dirname(dirname(__FILE__));
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'].'?'. $_SERVER['QUERY_STRING']
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']
取得檔案名稱與路徑 /var/www/include/abc.php
__FILE__;
取得檔案名稱 test.php
basename(__FILE__);
取得檔案名稱(不含附檔名) test
basename(__FILE__, '.php');
取得此目錄前的完整路徑 /var/www/include
dirname(__FILE__);
取得上層目錄前的完整路徑 /var/www
dirname(dirname(__FILE__));
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'].'?'. $_SERVER['QUERY_STRING']
http://www.mydomain.com/page/to/my/index.php?par=1
$_SERVER['SERVER_PROTOCOL'].'://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']
全站熱搜
留言列表