yakeing / php_template
PHP 模板分析。
v2.3.0
2019-08-08 02:05 UTC
Requires
- php: >=5.6
- ext-session: *
Requires (Dev)
- phpunit/phpunit: 5.7
README
PHP 模板分析,它可以快速编译原始模板并生成HTML显示页面。
Travis CI徽标
codecov徽标
Github徽标
安装
使用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--}
赞助商
如果您从我所创建的任何内容中获得价值,那么我将非常感谢您通过支付捐款来支持我。
作者
微博: yakeing
推特: yakeing