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>