獲取域名(第一種方法): document.hostname 獲取域名(第二種方法): document.domin 獲取端口號: location.port 獲取主機+端口號: location.host 需要注意的是獲取的域名 ...
lt script language javascript gt 獲取域名host window.location.host host document.domain 獲取頁面完整地址url window.location.href document.write lt br gt host host document.write lt br gt host host document.write ...
2018-01-15 14:39 0 1489 推薦指數:
獲取域名(第一種方法): document.hostname 獲取域名(第二種方法): document.domin 獲取端口號: location.port 獲取主機+端口號: location.host 需要注意的是獲取的域名 ...
當前url:http://api.gigacre.xyz:10380/home/info/focus_area.php ...
當前url:http://localhost:805/test/helloworld.php echo 'SERVER_NAME:'.$_SERVER['SERVER_NAME']; //獲取當前域名(不含端口號) echo '<p>'; echo 'HTTP_HOST ...
<script language="javascript"> //獲取域名 host = window.location.host; host2=document.domain; //獲取頁面完整地址 url = window.location.href ...
...
...
<?php //當前域名 echo Yii::app()->request->hostInfo; //除域名外的URL echo Yii::app()->request->getUrl(); //除域名外的首頁 ...
一、獲取當前域名 1、方法一 var domain = document.domain; 2、方法二 var domain = window.location.host; 但是獲取到的domain在線上環境中是域名,在本地環境是ip地址,所以寫了一下js代碼 var ...