承接 hoku-lib/httpstatuscoderesolver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hoku-lib/httpstatuscoderesolver

Composer 安装命令:

composer require hoku-lib/httpstatuscoderesolver

包简介

HttpStatusCodeResolver is a library for obtaining information on the HTTP status code.

README 文档

README

HttpStatusCodeResolver is a library for obtaining information on the HTTP status code.

Installation

The recommended way to install HttpStatusCodeResolver is through Composer.

composer require hoku-lib/httpstatuscoderesolver

Usage

Get a message.

<?php
require_once 'vendor/autoload.php';

$statusCodeInfo = \HttpStatusCodeResolver\HttpStatusCode::resolve(400);
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <?php if ($statusCodeInfo) : ?>
        <div><?=$statusCodeInfo[0]?></div>
        <div><?=$statusCodeInfo[1]?></div>
    <?php else : ?>
        <div>I do not know!</div>
    <?php endif; ?>
</body>
</html>

Output header.

<?php
require_once 'vendor/autoload.php';

\HttpStatusCodeResolver\HttpHeader::http_response_code(403);
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <h1>Forbidden!!!!</h1>
</body>
</html>

Original status code (When using http_response_code().)

<?php
require_once 'vendor/autoload.php';

http_response_code(987);
// -> HTTP/1.1 500 Internal Server Error
// Oh my God!!!!
// PHP converts the status code to 500...
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <div>Oh no...</div>
</body>
</html>

Original status code (When using HttpHeader::http_response_code().)

<?php
require_once 'vendor/autoload.php';

\HttpStatusCodeResolver\HttpHeader::http_response_code(987, 'MyOriginalCode');
// -> HTTP/1.1 987 MyOriginalCode
// Yay! Happy!
->
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <div>Yay!!!!</div>
</body>
</html>

License

HttpStatusCodeResolver is released under the MIT License. See the LICENSE file for details.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固