例如目前頁面的網址為:
https://www.yourdomain.com/index.php?a=123
則使用$_SERVER可顯示下列資訊
網域名稱 $_SERVER['HTTP_HOST'];
顯示 www. yourdomain.com
顯示 www. yourdomain.com
頁面完整網址 $_SERVER['REQUEST_URI'];
顯示 /index.php?a=123
頁面網址 $_SERVER['PHP_SELF'];
顯示 /index.php
傳入參數 $_SERVER['QUERY_STRING'];
顯示 a=123
沒有留言:
張貼留言