我一直试图在智能模板上显示php变量,但这是不可能的。
在我的第三方物流上的:
<a href="#">Welcome <strong><!--{$username}--></strong></a>我的php上的:
<?php
require('../common/Smarty/config.php'); //Smarty Config Class
require_once('../common/config/config.php'); //Project Config Class
require_once('../common/classes/Login.php'); //Login Class
$smarty = new Smarty();
$template = "login.tpl";
$smarty->assign ( "username", $user_name ); //first: smarty variable, last: php variable.
$smarty->display ( "{$template}" );
?>我试图做的是在登录页面上显示用户的用户名。
有什么帮助吗?
提前谢谢。
发布于 2014-04-14 16:03:19
在Smarty中,您应该只编写{$username},希望用户名出现在login.tpl文件中。
改变这个
<a href="#">Welcome <strong><!--{$username}-->``</strong></a>到这个
<a href="#">Welcome <strong>{$username}</strong></a>以上对我来说很管用。
https://stackoverflow.com/questions/23064347
复制相似问题