【问题标题】:Convert – into – PHP转换 - 成 - PHP
【发布时间】:2019-01-09 13:44:18
【问题描述】:

我有一个字符串。

例如 -> "Pirate Code – PVP Battles at Sea Trailer"

我想用"Pirate Code – PVP Battles at Sea Trailer" str_replace 但它失败了。

实际上–– 都代表“-”。我想将– 转换为–

所以我可以执行该功能。

【问题讨论】:

  • 请展示你到目前为止所做的尝试。
  • 我试过 htmlentities($str);但它不会转换它们
  • 要么get_html_translation_table()你的出路,或者只是使用html_entity_decode()我猜? 3v4l.org/TeKVi

标签: php string html-entities


【解决方案1】:

您可以为此使用str_replace()

str_replace("–", "–", "Pirate Code – PVP Battles at Sea  Trailer");

【讨论】:

    猜你喜欢
    • 2011-07-20
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 2016-08-01
    • 2016-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多