smarty php方法是什么

smarty php方法指的是“Smarty:php”函数,而“{php}”仅在SmartyBC中可用,语法如“{php}include('/path/to/display_weather.php');{/php}”。

推荐:《PHP视频教程》

Smarty:php函数

{php}

重要说明

Smarty已经废弃{php}标签,强烈建议不要使用。 请把你的PHP逻辑放到PHP程序或者插件函数中实现。

温馨提示:

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

{php}标签可以允许PHP代码直接嵌到模板中使用。 这些代码是否被编码,需要取决于$php_handling 的设置.

Example 7.61. {php}标签的使用

{php}
   // including a php script directly from the template.
   include('/path/to/display_weather.php');
{/php}

Example 7.62. {php}标签中使用全局变量来赋值变量

{* this template includes a {php} block that assign's the variable $varX *}
{php}
   global $foo, $bar;
   if($foo == $bar){
     echo 'This will be sent to browser';
   }
  // assign a variable to Smarty
  $this->assign('varX','Toffee');
{/php}
{* output the variable *}
<strong>{$varX}</strong> is my fav ice cream :-)

参见 $php_handling, {include_php}, {include}, {insert} 和 组件化模板.

更多关于云服务器域名注册虚拟主机的问题,请访问西部数码官网:www.west.cn

赞(0)
声明:本网站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-62778877-8306;邮箱:fanjiao@west.cn。本站原创内容未经允许不得转载,或转载时需注明出处:西部数码知识库 » smarty php方法是什么

登录

找回密码

注册