简体   繁体   English

Smarty 3出口标签

[英]Smarty 3 Exit Tag

IN Smarty 3 we are using 在Smarty 3中,我们正在使用

1 - {break} to break; 1- {break}打破; for continue; 继续 keyword 关键词

2- {continue} is used for continue; 2- {continue}用于continue; keyword I have written custom plugin for exit tag as which is same as break 我已经为退出标记编写了自定义插件作为关键字,它与break相同

<?php
    /*
    *   Modified for exit tag
    */

    function smarty_compiler_exit( $contents, &$smarty ) {
       return 'exit;';
    }
?>

BUT WHEN I USE {exit} it gives output as :- exit; only not working as php exit keyword 但是当我使用{exit}它的输出为:- exit; only not working as php exit keyword :- exit; only not working as php exit keyword

Why not use return ? 为什么不使用return

compiler.return.php editor.return.php

 <?php 
    function smarty_compiler_return($tag_arg, &$smarty) { 
    return "<?php return;?>"; 
    } 
    ?>

So when we call it like {return} within a TPL, it returns the flow to PHP. 因此,当我们在TPL中像{return}一样调用它时,它将把流程返回给PHP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM