vgd/sanitize_string 问题修复 & 功能扩展

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

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

vgd/sanitize_string

Composer 安装命令:

composer require vgd/sanitize_string

包简介

Sometimes you may want to clean a filename or string from foreign languages characters; with this class you can do both

README 文档

README

Version Total Downloads Latest Unstable Version License

Sometimes you may want to clean a filename or string from foreign languages characters; with this class you can do both.

Usage

Install via composer:

composer require vgd/sanitize_string

or

require('SanitizeString.php');


The class uses two boolean parameters after the string/filename: 

The first one (isFileName) is used to tell the class that you are trying to clean a file name.

The second one (special) must be used if you would like to remove special characters as well from a 
string or a file name.

In order to clean a string:

To remove foreign characters only:

echo SanitizeString::clean('Your string here');


To remove foreign AND special characters:

echo SanitizeString::clean('Your string here', false, true);

In order to clean a filename:

To remove foreign characters only:

SanitizeString::clean('Your filename here', true, false);


To remove foreign AND special characters:

SanitizeString::clean('Your filename here', true, true);


You can use absolute or relative paths for the file you want to rename.

Final Note

The main purpose of using associative arrays and not other techniques as regular 
expressions and preg_match etc. was to give the user the possibility of add or remove
characters depending of their needs.

Lets say that you have a spanish text and you want to remove all the characters but vowels 
with tilde and ñ characters; you can modify the arrays to achieve that.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固