Limit.php 859 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\common\behavior;
  3. class Limit
  4. {
  5. public function run(&$request)
  6. {
  7. $file = sys_get_temp_dir() . "/cps_redis_error";
  8. if (is_file($file)) {
  9. if (intval(file_get_contents($file)) >= time()) {
  10. http_response_code(502);
  11. header("Content-Type: text/html;charset=utf-8");
  12. echo '<meta charset="utf-8">';
  13. echo '<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">';
  14. echo '<title>502 Sorry, HTTP ERROR~</title>';
  15. echo '502 Sorry, HTTP ERROR~';
  16. echo "<br><br><br>";
  17. echo '<a href="javascript:window.location.reload();">点我重试一次</a>';
  18. die();
  19. } else {
  20. @unlink($file);
  21. }
  22. }
  23. }
  24. }