00f100 / fcphp-sinput
此包的最新版本(0.1.0)没有可用的许可信息。
用于清理输入内容的包
0.1.0
2018-08-14 02:31 UTC
Requires
- php: >=7.2
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-09-18 05:28:20 UTC
README
用于清理输入内容的包
如何安装
Composer
$ composer require 00f100/fcphp-sinput
或在 composer.json 中添加
{ "require": { "00f100/fcphp-sinput": "*" } }
如何使用
<?php use FcPhp\SInput\SInput; use FcPhp\SInput\Rules\AddSlashes; use FcPhp\SInput\Rules\HtmlEntities; use FcPhp\SInput\Rules\StripTags; $instance = new SInput(); $instance->addRule('addslashes', new AddSlashes()); $instance->addRule('htmlentities', new HtmlEntities()); $instance->addRule('striptags', new StripTags()); $content = [ 'con"ntent' => 'value"', "ch'~ve" => "value'2", 'tag' => '<tag>content</tag>', ]; $this->instance->executeRules(['striptags', 'htmlentities', 'addslashes'], $content); // Print: // // Array( // 'con"ntent' => 'value"', // 'ch\\\'~ve' => 'value\\\'2', // 'tag' => 'content' // ) // echo $content;