yakeing/php_template

PHP 模板分析。

v2.3.0 2019-08-08 02:05 UTC

This package is auto-updated.

Last update: 2024-09-16 13:29:06 UTC


README

PHP 模板分析,它可以快速编译原始模板并生成HTML显示页面。

Travis CI徽标

Travis-ci

codecov徽标

codecov

Github徽标

Downloads Size tag license languages

安装

使用Composer安装库。当然,您也可以前往Packagist查看。

    $ composer require yakeing/php_template

调试模板

  • 示例
    //Template path
    $tpl = new template("/home/www/mould/");

    $tpl->assign("title","I was the title");
    $tpl->assign("arr",array('aaa','bbb','ccc'));

    //The transfer of files at the same time output
    $tpl->GetFile("header.html")->GetFile("index.html")->GetFile("footer.html")->render();

格式

  • 示例
    {if $array}...{elseif $array[0]!=null}...{else}...{/if}

foreach

  • 示例
    {foreach $array as $key => $value}...{$key} => {$value}...{/foreach}

while

  • 示例
    {$i = 1}...{while $i < $j}...{$i}...{$i++}...{/while}

for

  • 示例
    {for ($i=0;$i<count($array);$i++)}...{$array[$i]}...{/for}

switch

  • 示例
    {switch $str} ..{case 1}...{break}...{default}...{/switch}

分配或计算

  • 示例
    {$i = 1} OR {$t=2}
    {$i++}
    {$i--}

赞助商

如果您从我所创建的任何内容中获得价值,那么我将非常感谢您通过支付捐款来支持我。

Sponsor

作者

微博: yakeing

推特: yakeing