leonid-slv/php-rtf-template
最新稳定版本:v1.0
Composer 安装命令:
composer require leonid-slv/php-rtf-template
包简介
Simple library for working with templates. Works on any PHP version, no additional libraries or dependencies are used. RTF files can be used from under any text editor, including MS Word. Supported formats UTF-8 and CP1251.
README 文档
README
Simple library for working with templates. Works on any PHP version, no additional libraries or dependencies are used. RTF files can be used from under any text editor, including MS Word. Supported formats UTF-8 and CP1251.
The library looks for the text in the [template] view and replaces it with a value.
Examples:
More examples can be found in the /Examples
Simple easy example:
$rtf = '{\rtf1\ansi\ansicpg1251\deff0\nouicompat\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset204 Calibri;}}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang1033 Hello\f1\lang1049 \f0\lang1033 [template], my name PHP RTF Template!\lang9\par
}
';
$rtf = rtf_easy_replace($rtf,'template','world');
Normal replace:
$rtf = '{\rtf1\ansi\ansicpg1251\deff0\nouicompat\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset204 Calibri;}}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang1033 Hello\f1\lang1049 \f0\lang1033 [template], my name PHP RTF Template!\lang9\par
}
';
$template = rtf2template($data);
foreach ($template as $value)
{
if (rtf_compare('template','world')
{
$template = str_replace('['.'template'.']',text2rtf('world'),$rtf);
}
}
About:
*@Author Selvistrovich Leonid
*@Mail crack-it@yandex.com
@version 1.0, 02.12.2020
统计信息
- 总下载量: 1.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2020-12-02