【问题标题】:I am getting error while loading <a href="linktext.com">linktext.com</a> from SQL with help of PHP [closed]在 PHP 的帮助下从 SQL 加载 <a href="linktext.com">linktext.com</a> 时出现错误 [关闭]
【发布时间】:2018-02-17 04:25:29
【问题描述】:

我正在尝试使用 php 在网页上从 SQL 加载一些数据,但是当 sql 文本数据中存在超链接时,一切都会停止……比如 linktext.com。

尝试了html特殊字符但不起作用。

【问题讨论】:

  • 问题对我来说不清楚,因为 OP 提供的信息不多。
  • 你遇到了什么错误?更新你的代码
  • “不工作”是什么意思?您需要显示一些实际代码,您面临什么样的错误 - 基本上是自己调试!如果您不向我们提供帮助您所需的信息,我们将无法帮助您!

标签: php html sql hyperlink


【解决方案1】:

我猜你需要在 SQL 中转义引号或使用单引号。

我会说你的代码输出的链接格式不正确。

$url="<a href="link.com">link.com</a>"; ## << This is the value from the database
echo $url;

如您所见,双引号过多,您需要在代码中坚持使用双引号方案并在变量(本例中为数据库)中使用单引号或转义字符串

$url = "<a href=\"link.com\">link.com</a>";

$url = "<a href='link.com'>link.com</a>";

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-27
  • 2021-07-30
  • 1970-01-01
  • 1970-01-01
  • 2016-08-09
相关资源
最近更新 更多