This article mainly shares with you the method of obtaining the current domain name in PHP. It mainly shares with you a small piece of code. I hope it can help you.
<? //获取当前的域名: echo $_SERVER['SERVER_NAME']; //获取来源网址,即点击来到本页的上页网址 echo $_SERVER["HTTP_REFERER"]; $_SERVER['REQUEST_URI'];//获取当前域名的后缀 $_SERVER['HTTP_HOST'];//获取当前域名 dirname(__FILE__);//获取当前文件的物理路径 dirname(__FILE__)."/../";//获取当前文件的上一级物理路径
Related recommendations:
How to use JS to determine the current domain name and jump to the specified page
php gets the current domain name and path
php gets the current domain name: PHP gets the current URL domain name
The above is the detailed content of How to get the current domain name in PHP. For more information, please follow other related articles on the PHP Chinese website!
How to open php file
How to remove the first few elements of an array in php
What to do if php deserialization fails
How to solve the problem of slow server domain name transfer
How to connect php to mssql database
How to connect php to mssql database
How to upload html
How to solve garbled characters in PHP