我有一个变量:
$myvar = 'myarchive.pdf';
如何将其嵌入到this:
echo('<tr> <td> <a href="nextpage.php?file=trial.pdf"> download now </a> </td> </tr>');
我想知道是否有一种方法可以这样做:
echo('<tr> <td> <a href="nextpage.php?file=".'$myvar'.> download now </a> </td> </tr>');
您没有正确地将变量附加到字符串。你还必须附上nextpage。php?文件=变量在引号内。但是您在变量名之前关闭了它。
<a href="nextpage.php?file=".'$myvar'.>
^
所以试试
echo('<tr> <td> <a href="nextpage.php?file='.$myvar.'"> download now </a> </td> </tr>');
try this
echo('<tr> <td> <a href="nextpage.php?file='.$myvar.'> download now </a> </td> </tr>');
应该可以。如果必须,请重新添加括号
echo '<tr><td><a href="nextpage.php?file='.$myvar.'">download now</a></td></tr>';