thinkphp模板中使用函数的方法

1、执行函数并输出返回值
格式:{:function(…)} 
例如,输出U函数的返回值:

  1. {:U('User/insert')}

编译后的PHP代码是

  1. <?php echo U('User/insert');?>

2、执行函数但不输出
格式:{~function(…)} 
例如,调用say_hello函数:
  1. {~say_hello('ThinkPHP')}

编译后的PHP代码是:
  1. <?php say_hello('ThinkPHP');?>


你可能感兴趣的:(thinkphp模板中使用函数的方法)