Note

    在Smarty 3.1,{php}仅在SmartyBC中可用。


    Example 7.61. {php}标签的使用

    1. {* this template includes a {php} block that assign's the variable $varX *}
    2. {php}
    3. if($foo == $bar){
    4. echo 'This will be sent to browser';
    5. }
    6. // assign a variable to Smarty
    7. {/php}
    8. {* output the variable *}
    9. <strong>{$varX}</strong> is my fav ice cream :-)
    10.  

    参见 , , , 和 组件化模板.