2010-12-22 82 views

回答

0

$_SERVER變量有很多,你可能要考慮,其中之一是$_SERVER['HTTP_HOST'](如果你想多數民衆贊成被查詢的網站)的值。

$thisSite = 'http://'.$_SERVER['HTTP_HOST'].'/'; 

歌廳,如果他們使用的萬維網,使用stripos

if (stripos($_SERVER['HTTP_HOST'],'www.') === 0) { /* they used www */ } 
0

對於像URL:
localhost/myblog/
http://domain.com/blog/

使用:get_site_url()