简体   繁体   English

无法回显变量

[英]Can't echo variable

I'm thinking it's the smarty templates setup that is preventing me from echo'ing the $setlnk variable elsewhere on the page. 我认为这是一个聪明的模板设置,阻止我回应页面上其他地方的$ setlnk变量。 Or, am i'm doing something else wrong. 或者,我正在做其他错误的事情。 Is there another method I could use? 我可以使用另一种方法吗?

<?php
$setlnk = "<img src='/files/pvtexp.php?mid=" . $set[2] . "&iid=" . $set[3] . "&idat=" . $set[4] . "/" . $set[5] . "&sec=" . $set[6] . "'>";       

echo $setlnk; echo $ setlnk; // works //有效
?> ?>

..... html code

<?=$setlnk;?> // doesn't work
<?php echo $setlnk; ?> // doesn't work

if this is a smarty template, you need to do the following: 如果这是一个聪明的模板,您需要执行以下操作:

  • PHP file: $template->assign('setlnk', $setlnk); PHP文件: $ template-> assign('setlnk',$ setlnk); // template is the SMARTY template object // template是SMARTY模板对象
  • TPL file (smarty template) : {$setlnk} TPL文件(智能模板) :{$ setlnk}

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

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