我有这个php代码:
<?php
if(isset($_POST['gen'])){
$genapi = "http://domain.com/api.php";
$result5 = htmlentities(file_get_contents($genapi));
list($first, $last) = explode(':', $result5);
header('Location: minecraft.php?line='.$result5);
}
?>
我遇到了麻烦,因此,如果“ $ result5”返回“否”,则要等待2秒钟,然后重试,但是如果“ $ result5”没有返回“否”,它将运行标题行。
if(isset($_POST['gen'])){
$loop = true;
while($loop){
$genapi = "http://domain.com/api.php";
$result5 = htmlentities(file_get_contents($genapi));
if($result5 !== 'no'){ // check your $result5 based on the value it returns
$loop = false;
list($first, $last) = explode(':', $result5);
header('Location: minecraft.php?line='.$result5);
}
else{
sleep(2);
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句