LII. Net_Gopher

简介

The gopher protocol, as defined by RFC 1436, is generally considered the ancestor of the modern HTTP protocol. However, gopher was also intended to provide references to non-gopher resources including telnet, wais, nntp, and even http. This extension adds gopher support to PHP's URL Wrappers, and provides a helper function gopher_parsedir() to make sense of gopher formatted directory listings.

安装

Prerequisite: PHP 4.3.0 or higher.

安装此 PECL 扩展库的信息可在手册中标题为 PECL 扩展库安装的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: http://pecl.php.netnet_gopher

运行时配置

本扩展模块在 php.ini 中未定义任何配置选项。

资源类型

本扩展模块未定义任何资源类型。

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

表 1. Net_Gopher constants

ConstantValueDescription
GOPHER_DOCUMENT0Standard text/plain document.
GOPHER_DIRECTORY1A resource containing a gopher formatted directory listing.
GOPHER_BINHEX4A BinHex encoded binary file.
GOPHER_DOSBINARY5A DOS formatted binary archive.
GOPHER_UUENCODED6A UUEncoded file.
GOPHER_BINARY9A generic binary file.
GOPHER_INFO255An Informational entry
GOPHER_HTTP254A reference to an HTTP resource.
GOPHER_UNKNOWN-1 An unrecognized entry.

范例

<?php
readfile
("gopher://gopher.example.com/somedocument");
?>

目录
gopher_parsedir -- Translate a gopher formatted directory entry into an associative array.