refactor
This commit is contained in:
parent
4460e5c2c3
commit
ed48d61eda
20
index.php
20
index.php
@ -1,18 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
$codes = [
|
|
||||||
204,
|
|
||||||
301,
|
|
||||||
400,
|
|
||||||
401,
|
|
||||||
402,
|
|
||||||
403,
|
|
||||||
404,
|
|
||||||
410,
|
|
||||||
423,
|
|
||||||
501,
|
|
||||||
];
|
|
||||||
|
|
||||||
$codes2string = [
|
$statusCodes = [
|
||||||
204 => 'No Content',
|
204 => 'No Content',
|
||||||
301 => 'Moved Permanently',
|
301 => 'Moved Permanently',
|
||||||
400 => 'Bad Request',
|
400 => 'Bad Request',
|
||||||
@ -25,12 +13,16 @@ $codes2string = [
|
|||||||
501 => 'Not Implemented',
|
501 => 'Not Implemented',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$codes = array_keys($statusCodes);
|
||||||
|
|
||||||
$code = $codes[random_int(0, count($codes) - 1)];
|
$code = $codes[random_int(0, count($codes) - 1)];
|
||||||
$codeString = $codes2string[$code];
|
$codeString = $statusCodes[$code];
|
||||||
$headline = $code.' '.$codeString;
|
$headline = $code.' '.$codeString;
|
||||||
|
|
||||||
http_response_code($code);
|
http_response_code($code);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head><title><?= $headline ?></title></head>
|
<head><title><?= $headline ?></title></head>
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user