좋아요, 다른 날에 여기에 게시했습니다. 도움이 많이되어 다시 방문하기로 결정했습니다. 같은 코드에 또 다른 문제가 있습니다. 내가 사용했던 소스를 "$ location_url2"라고 추가하고 싶었지만 코드에 맞는 두 번째 "$ content"를 추가했습니다. 두 소스의 차이점은 "$ location_url"은 아무 것도 없으면 빈 페이지를 반환하지만 아무것도 발견되지 않으면 "$ lcation_url2"가 index.php로 리디렉션되지만 URL에 확장명을 유지합니다 ... 코드 사용 :페이지를 정확히 찾을 수 없을 때 리디렉션
<?php
if(isset($_POST['search'])) {
$search_text = $_POST['search'];
$location_url = "http://cydia.saurik.com/package/{$search_text}/";
$location_url2 = "http://rpetri.ch/cydia/{$search_text}/";
$content = @file_get_contents($location_url);
$content2 = @file_get_contents($location_url2);
if($content) {
header("Location: {$location_url}");
} else if($content2) {
header("Location: {$location_url2}");
} else {
header("Location: suggest.php");
}
}
?>
HTML 코드 것은 : 당신이 아무 것도 발견되지 때 두 개의 링크가 아무것도 돌려주지 않는 절대적으로 확신하지 않는 한
<div id="content">
<div id="search">
<form method="POST" name="search" action="search.php">
<input type="text" name="search" name="placeholder" placeholder="Search Tweaks..."/>
<input type="submit" name="submit" value="Search"/>
</form>
</div>
</div>