PHP code example of baagee / php-template

1. Go to this page and download the library: Download baagee/php-template library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

baagee / php-template example snippets


interface ViewInterface
{   
    // 渲染,返回解析后的html模板
    public static function render(string $source, array $data = []);
    
    // 渲染并输出 没有返回
    public static function display(string $source, array $data = []);
}
html
<b>跑车简介:</b>{{$item['aaa']['description']}}<br>
html
{{if $pp['active']==1}}
<li class="am-active"><a href="javascript:;">{{$p}}</a></li>
{{elseif $pp['active']==2}}
<li><a href="{{$pp['url']}}">{{$p}}</a></li>
{{else}}
<li><a href="">{{$p}}</a></li>
{{fi}}
html
<input type="text" name="sdfsd" value="{{php echo $_GET['ffg']??''}}" class="am-form-field" placeholder="车牌号">