我想把下面的 VBScript 变成 PHP:
Dim RootDomain : RootDomain = Request.ServerVariables("server_name")
Dim paryDomain : paryDomain = Split(RootDomain,".")
IF uBound(paryDomain) = 1 THEN
RootDomain = paryDomain(0) & "." & paryDomain(1)
ELSEIF uBound(paryDomain) = 2 THEN
RootDomain = paryDomain(1) & "." & paryDomain(2)
END IF
IF RootDomain = "storeboard.com" THEN
G_SYSTEMID = 1
ELSEIF RootDomain = "dcwn.org" THEN
G_SYSTEMID = 2
END IF
我做了以下几点:
$Domain = $_SERVER['SERVER_NAME'];
$paryDomain = explode(".",$Domain);
$Array = count($paryDomain)
if ($Array == "1")
{
$RootDomain = $paryDomain[0].'.'.$paryDomain[1];
}
elseif ($Array == "2")
{
$RootDomain = $paryDomain[1].'.'.$paryDomain[2];
}
echo $RootDomain
我是 PHP 的初学者,我收到以下错误:
PHP Parse error: syntax error, unexpected T_IF in C:\inetpub\mydomain.com\testing\test_sql_server.php on line 53
第 53 行是:
if ($Array == "1")
我究竟做错了什么?任何帮助将不胜感激。