如何用变量回显超链接? [英] How to echo a hyperlink with a variable?

查看:158
本文介绍了如何用变量回显超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正确地获取这些超链接并将HTML与PHP混合似乎是我不断的悲伤源泉。这个超链接怎么了?

Getting these hyperlinks right and mixing HTML with PHP seems to be a constant source of sorrow for me. Whats wrong with this hyperlink?

echo '<a href = "googler.php?query='.$suggestion[$ss_count].'">$suggestion[$ss_count]</a><br>;


推荐答案

它应该是

echo '<a href = "googler.php?query='.$suggestion[$ss_count].'">'.$suggestion[$ss_count].'</a><br>';

在单引号内,变量不会被插值,因此您必须从字符串文字中提取链接文本。

Within single quotes variables are not interpolated so you have to pull the link text out of the string literal.

这篇关于如何用变量回显超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆