외부 소스를 사용하여 내 웹 사이트 사용자 위치를 얻으므로 사이트를 사용자 정의 할 수 있지만 사용하는 외부 소스가 때때로 매우 느려서 내 속도가 느려질 수 있습니다. 사이트 다운 내가 cURL
을 사용하여 외부 데이터를 얻고 나는 시간 초과 기능을 구현했습니다 curl_setopt($ch,CURLOPT_TIMEOUT,1000);
하지만 시간이 초과되면 페이지로드가 중단되고 페이지 절반이 누락됩니다.설정 시간이 지나면 스크립트 실행 중지
이 스크립트가 사람이 어떻게 $의 geoplugin을 중지하지만이 많이 주시면 감사하겠습니다 페이지를로드 계속하는 어떤 아이디어가 있다면 내 웹 사이트
$i = 1;
$geoplugin = new geoPlugin();
$geoplugin->locate();
if(empty($_SESSION['country'])) {
$conchk = $geoplugin->countryName;
$_SESSION['country'] = $conchk;
}
else { $conchk = $_SESSION['country']; }
if(empty($conchk)) {$countrygeo = "NULL_CONT";} else {$countrygeo = $conchk;}
//$countrygeo = "Spain";
$country_find = mysql_query("SELECT * FROM country_list
WHERE country='$countrygeo' LIMIT 1");
while($row_cou = mysql_fetch_array($country_find)) {
$rowcov = $row_cou[1];
//Geo-location default!
print "<option selected value=\"$rowcov\">$rowcov</option>\n";
$kvar = 1;
}
//finish first while loop!
//if we cant find the geo-country in the list print the whole table!
$country_full_list_print = mysql_query("SELECT * FROM country_list
ORDER BY country ASC");
while($row_full = mysql_fetch_array($country_full_list_print)) {
if(($row_full[1] == "United Kingdom") && ($i == 1) && (empty($kvar))) {
print "<option selected value=\"$row_full[1]\">$row_full[1]</option>\n"; $i++; }
//always print uk as default if no results.
elseif ($row_full[1] == $rowcov) { }
else {
print "<option value=\"$row_full[1]\">$row_full[1]</option>\n"; } //this is the default print!
} //close while loop and if num_rows less than 1.
에 사용입니다.
예외 루프를 사용해보십시오. http://nz.php.net/exceptions –
@ 대각성 : hehe, php.net은 프로필을 방문 할 필요없이 귀하의 위치를 공개합니다 :-) – zerkms