pear/http2 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pear/http2

最新稳定版本:v2.0.0

Composer 安装命令:

composer require pear/http2

包简介

Miscellaneous HTTP utilities

README 文档

README

Static methods for doing miscellaneous HTTP related stuff like date formatting, language negotiation or HTTP redirection.

Features

  • Language negotiation
  • MIME type negotiation
  • Charset negotiation
  • Send HEAD requests to URLs
  • Make URLs absolute
  • Parse HTTP Link: header values (RFC 5988)

Installation

$ composer require pear/http2 

Usage

Language negotiation

Quality factors in the Accept-Language: header are supported, e.g.:

Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8 

Code:

<?php $http = new HTTP2(); $langs = array( 'en' => 'locales/en', 'en-US' => 'locales/en', 'en-UK' => 'locales/en', 'de' => 'locales/de', 'de-DE' => 'locales/de', 'de-AT' => 'locales/de', ); $neg = $http->negotiateLanguage($langs); $dir = $langs[$neg]; ?> 

Charset negotiation

<?php $http = new HTTP2(); $charsets = array( 'UTF-8', 'ISO-8859-1', ); $charset = $http->negotiateCharset($charsets); ?> 

MIME type negotiation

<?php $http = new HTTP2(); $contentType = array( 'application/xhtml+xml', 'application/xml', 'text/html', 'text/plain', ); $mime = $http->negotiateMimeType($contentType); ?> 

Links

Homepage
http://pear.php.net/package/HTTP2
Bug tracker
http://pear.php.net/bugs/search.php?cmd=display&package_name[]=HTTP2
Documentation
http://pear.php.net/package/HTTP2/docs
Unit test status

https://travis-ci.org/pear/HTTP2

https://travis-ci.org/pear/HTTP2.svg?branch=master
Packagist
https://packagist.org/packages/pear/http2

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固