Rumah >pembangunan bahagian belakang >tutorial php >PHP获取当前页面的因特网址

PHP获取当前页面的因特网址

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBasal
2016-06-13 12:13:551021semak imbas

PHP获取当前页面的网址

PHP获取当前页面的网址

<span style="color: #0000ff;">function</span><span style="color: #000000;"> GetCurUrl(){  </span><span style="color: #800080;">$url </span>= 'http://'<span style="color: #000000;">;  </span><span style="color: #0000ff;">if</span>(<span style="color: #0000ff;">isset</span>(<span style="color: #800080;">$_SERVER</span>['HTTPS']) AND <span style="color: #800080;">$_SERVER</span>['HTTPS'] == 'on'<span style="color: #000000;">)  {    </span><span style="color: #800080;">$url</span> = 'https://'<span style="color: #000000;">;  }  </span><span style="color: #0000ff;">if</span>(<span style="color: #800080;">$_SERVER</span>['SERVER_PORT'] != '80'<span style="color: #000000;">)  {    </span><span style="color: #800080;">$url</span> .= <span style="color: #800080;">$_SERVER</span>['HTTP_HOST'].':'.<span style="color: #800080;">$_SERVER</span>['SERVER_PORT'].<span style="color: #800080;">$_SERVER</span>['REQUEST_URI'<span style="color: #000000;">];  }  </span><span style="color: #0000ff;">else</span><span style="color: #000000;">  {    </span><span style="color: #800080;">$url</span> .= <span style="color: #800080;">$_SERVER</span>['HTTP_HOST'].<span style="color: #800080;">$_SERVER</span>['REQUEST_URI'<span style="color: #000000;">];  }  </span><span style="color: #0000ff;">return</span> <span style="color: #800080;">$url</span><span style="color: #000000;">;}</span>

 

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn