【问题标题】:fwrite quotes in href [duplicate]在href中写引号[重复]
【发布时间】:2018-07-17 10:55:55
【问题描述】:

我在 fwrite 中遇到了 href 引号问题。 我没有的是这样的:

fwrite($fp, "Some text ".$SomeVar." some text :".$SomeVar.". Some text <a href="https://www.google.com/" target="_blank"><br>Some text <a href="https://www.google.com/" target="_blank">");

有什么方法可以将这些 href 引号标记为纯文本?

我在某处读到使用双引号可能会有所帮助,但它没有。我也试过:
&lt;a href="https://www.google.com/\" target="_blank\"&gt;

谢谢。

【问题讨论】:

  • 如果您的字符串包含引号,请为您的字符串使用单引号

标签: php quotes fwrite


【解决方案1】:

当你的字符串包含双引号时使用单引号会更容易:

$string = '<a href="https://cia.gov">CIA</a>';

或者,您可以像这样转义引号:

$string = "<a href=\"https://cia.gov\">CIA</a>";

【讨论】:

  • 它不工作...我的意思是它可以,但如果在 exe 链接中查看为 php,则根本不会显示。
  • 更新您的问题。代码。预期产出,实际产出。 exe链接是什么意思?
  • 我的错误。我忘记了游戏对链接的看法不同。对不起。现在效果很好。
猜你喜欢
  • 1970-01-01
  • 2011-02-08
  • 2019-10-01
  • 1970-01-01
  • 2014-08-14
  • 1970-01-01
  • 2012-12-27
  • 2012-01-06
  • 1970-01-01
相关资源
最近更新 更多