jontynewman/html-filter
Composer 安装命令:
composer require jontynewman/html-filter
包简介
A stream filter for converting special HTML characters.
README 文档
README
A stream filter for converting special HTML characters.
Installation
composer require 'jontynewman/html-filter ^1.0'
Example
<?php
use JontyNewman\HtmlFilter;
require 'vendor/autoload.php';
HtmlFilter::passthru(__FILE__, 'rb');
The static "passthru" method provides a shorthand for the following code.
<?php
use JontyNewman\HtmlFilter;
require 'vendor/autoload.php';
$handle = HtmlFilter::open(__FILE__, 'rb');
if (false === fpassthru($handle)) {
throw new RuntimeException('Failed to pass through stream');
}
if (false === fclose($handle)) {
throw new RuntimeException('Failed to close stream');
}
In addition, the static "open" method provides a shorthand for the following code.
<?php
use JontyNewman\HtmlFilter;
require 'vendor/autoload.php';
HtmlFilter::register();
$handle = fopen(__FILE__, 'rb');
if (false === $handle) {
throw new RuntimeException('Failed to open stream');
}
if (false === stream_filter_append($handle, HtmlFilter::NAME)) {
throw new RuntimeException('Failed to append filter');
}
if (false === fpassthru($handle)) {
throw new RuntimeException('Failed to pass through stream');
}
if (false === fclose($handle)) {
throw new RuntimeException('Failed to close stream');
}
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-31