麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
[HELP]改php5的写法
悬赏分:20 - 2007年08月17日

怎么把下面的代码改成php4的写法?我不会写php5
提示错误arse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in D:\temp\pb\CountryFromIP.inc.php on line 11
我没有装php5。。。
[PHP]
<?Php
/**
* This class generates the country name and its flag from its IP address
*
*
* @author Rochak Chauhan
*/

class CountryFromIP {

private $CountryIPDatabase = 'CountryIPDatabase.txt';
private $ip = '';

/**
* Function to validate IP ( please modify it according to your needs)
*
* @param $ip - string
*
* @return boolean
*/
public function ValdateIP($ip) {
$ipArray = explode(',',$ip);

if(count($ipArray) != 4) {
echo " ERROR: Invalid IP";
return false;
}
else {
return true;
}
}

/**
* Function to return Country name from the IPDatabase
*
* @param $ip string
*
* @return string - name of the country, false otherwise
*/
public function GetCountryName($ip) {
$this->ip = $ip;
$ip = sprintf("%u", ip2long($ip));

$csvArray = file($this->CountryIPDatabase);

for($i=0; $i $arrayOfLine = explode(',', $csvArray[$i]);
if($ip >= $arrayOfLine[0] && $ip <= $arrayOfLine[1] ) {
return $countryName = $arrayOfLine[2];
}
}
return false;
}

/**
* Function to return local path to Country's flag
*
* @param $ip - string
*
* @return string - local path to flag image
*/
public function ReturnFlagPath() {

if($countryName = trim(ucwords(strtolower($this->GetCountryName($this->ip))) )) {
$countryName = str_replace(' ','%20',$countryName);
return "flag/$countryName.gif";
}
else {
return false;
}
}

}
?>

[/PHP]

提问者:nany   08-17 16:04
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
52 + 24 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM