我有这个连接的mysqli:化妆用户等待尝试重新连接 - mysqli的PHP
$mysqli_c = new mysqli($host, $us, $password, $bd);
if (mysqli_connect_errno()) {
if (mysqli_errno() == 1203) {
header("Location: too_many.php");
exit;
}
}
这得到了“太多的连接”的错误。
我想要的是,而不是重定向到too_many.php,如果错误1203发生,我想在10秒后再次尝试。这样用户可以认为我的网站加载速度很慢,但他不会看到错误页面。
任何ideasis如何做到这一点?可以吗?
你可以循环,直到它连接但如果数据库实际上是下降,用户将只是循环,直到他们关闭网页.. – chris85
看看这个Q&A http://stackoverflow.com/questions/32031685/php-if-no-results-wait-and-try-again and possibly http://stackoverflow.com/questions/35890629/php-echo-first-row-wait-sleep-then-echo-第二行可以使用'sleep()'函数给你一些想法。 –
@ chris85噢,也许尝试连接一两次,然后重定向,如果不可能的话! –