perf / http-status
允许与要注入HTTP头部的HTTP状态字符串进行交互。
3.1.0
2021-08-17 10:04 UTC
Requires
- php: >=7.4
Requires (Dev)
- ext-xdebug: *
- phing/phing: ^2.16
- phpmd/phpmd: ^2.8
- phpunit/phpunit: ^9.2
- squizlabs/php_codesniffer: ^3.5
README
允许与要注入HTTP头部的HTTP状态字符串进行交互。
安装
composer require perf/http-status
使用
具体调用
<?php use perf\HttpStatus\HttpStatusRepository; $repository = HttpStatusRepository::createDefault(); $httpStatus = $repository->get(404); echo $httpStatus->getReason(); // Will print "Not Found" echo $httpStatus->toHeader(); // Will print "HTTP/1.1 404 Not Found"
静态调用
<?php use perf\HttpStatus\HttpStatusRepository; $httpStatus = HttpStatusRepository::createDefault()->get(404); echo $httpStatus->getReason(); // Will print "Not Found" echo $httpStatus->toHeader(); // Will print "HTTP/1.1 404 Not Found"