patinthehat/templated-text

基本的文本模板系统

v1.1.0 2017-02-13 16:21 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:55:13 UTC


README

Permafrost Templated Text

PHP 5+ 的基本文本模板。

安装

使用 composer 安装: composer require patinthehat/templated-text

示例用法

<?php

include 'vendor/autoload.php';

use Permafrost\TemplatedText\TemplatedText;

$tt = new TemplatedText;

$tt ->variable('one', 'OONNEE')
    ->variable('hw', 'Hello World')
    ->filter('test', function($v) { return '->>'.$v.'<<-'; })
    ->template('This is a test template, one is {{one|aquote}} and {{hw}}! then, {{hw | quote | test}}!! and {{one | quote}} ');

echo $tt->process() . PHP_EOL . PHP_EOL;

示例输出

这是一个测试模板,一个是指 ->OONNEE<- 和 Hello World! 然后,->>"Hello World"<<-!! 和 "OONNEE"

许可证

本项目采用MIT 许可证