diamochang / i7h-php
在PHP中实现RimoChan的i18nglish,无需担心XSS攻击。
dev-m2n
2024-05-05 04:13 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-05 04:55:55 UTC
README
本项目可以实现由 i18nglish,由 RimoChan 创建,在PHP中实现,无需担心XSS攻击。
工作原理
示例文本取自Richard M. Stallman的 Free Software Song 歌词。
之前
When we have enough free software
At our call, hackers, at our call,
We'll kick out those dirty licenses
Ever more, hackers, ever more.
之后
W2n we h2e e4h f2e s6e
At o1r c2l, h5s, at o1r c2l,
We'll k2k o1t t3e d3y l6s
E2r m2e, h5s, e2r m2e.
(注意:我在“we'll”中添加了撇号,它原本在转义过程中丢失了。)
如何使用它
- 克隆整个仓库。如果速度慢,尝试将Git URL中的
hub
改为ee
以使用Gitee镜像。您还可以使用Composer:composer require diamochang/i7h-php
。 - 将
i7h.php
移动到您的项目中。如果您使用Composer安装,则可以跳过此步骤。 - 将依赖项添加到您想要使用的代码中
// Please refer to the actual location of i7h.php. require_once "i7h.php";
- 使用以下代码调用它
// Instantiate the i7h class $i7h = new i7h(); // Call the i18n method to process the string and output the result. echo $i7h->i18n('what you want to convert')
- 工作已完成。
已知问题
- 在转义过程中可能丢失英文撇号
贡献
欢迎PR,欢迎问题。