在echo和href行中使用html和php [英] use both html and php in echo and href line
本文介绍了在echo和href行中使用html和php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个变数:
I have the variable:
$myvar = 'myarchive.pdf';
我如何嵌入它:
echo('<tr> <td> <a href="nextpage.php?file=trial.pdf"> download now </a> </td> </tr>');
我不知道是否有办法像这样做:
I wonder if there is a way to do it like this:
echo('<tr> <td> <a href="nextpage.php?file=".'$myvar'.> download now </a> </td> </tr>');
推荐答案
您没有正确地将该变量追加到字符串中。你也必须将 nextpage.php?file = variable 放在引号内。但是你在变量名之前关闭它。
You are not appending the variable to the string properly. Also you have to enclose nextpage.php?file=variable within quotes. But you are closing it before the variable name.
<a href="nextpage.php?file=".'$myvar'.>
^
所以试试
So try with
echo('<tr> <td> <a href="nextpage.php?file='.$myvar.'"> download now </a> </td> </tr>');
这篇关于在echo和href行中使用html和php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文