1 | <span style= "color: #000000;" >php require </span><span style= "color: #800000;" > '</span><span style="color: #800000;">Tpl.class.php</span><span style="color: #800000;">' </span><span style= "color: #000000;" >; $tpl </span>= <span style= "color: #0000ff;" > new </span><span style= "color: #000000;" > Tpl(); $tplarr </span>=<span style= "color: #000000;" > array ( </span><span style= "color: #800000;" > '</span><span style="color: #800000;">name</span><span style="color: #800000;">' </span>=><span style= "color: #800000;" > '</span><span style="color: #800000;">waited</span><span style="color: #800000;">' </span><span style= "color: #000000;" >, </span><span style= "color: #800000;" > '</span><span style="color: #800000;">age</span><span style="color: #800000;">' </span>=><span style= "color: #800000;" > '</span><span style="color: #800000;">100</span><span style="color: #800000;">' </span><span style= "color: #000000;" > ); $tpl </span>-><span style= "color: #000000;" >assign( $tplarr ); $tpl </span>->assign(<span style= "color: #800000;" > '</span><span style="color: #800000;">message</span><span style="color: #800000;">' </span>,<span style= "color: #800000;" > '</span><span style="color: #800000;">this is a demo</span><span style="color: #800000;">' </span><span style= "color: #000000;" >); $tpl </span>->display(<span style= "color: #800000;" > '</span><span style="color: #800000;">testTpl.html</span><span style="color: #800000;">' </span><span style= "color: #000000;" >);</span>?>
|
登录后复制
输出:waited:100:this is a demo
生成编译文件:972fa4d270e295005c36c1dbc7e6a56c.php