在一个单独的 YML 文件中,我有:
flags: [<img src="/images/cms_bo/icons/english.png" alt="English"/>]
当我将其调用到我的代码中时,它不会被解释,所以我使用了 html_entity_decode

它有效,但我的图像 之前只有 1 个奇怪的字符:

<?php echo html_entity_decode($form['lang']->render()); ?>

我所有的文件都是UTF8编码的。你知道我错过了什么来解决这个问题吗?

PS:
      public static function getI18nCulturesForChoice()
  {
      return array_combine(self::getI18nCultures(), self::getI18nCulturesFlags());
  }

最佳答案

尝试使用 html_entity_decode($form['lang']->render(),ENT_QUOTES, "UTF-8");

关于php - 执行 html_entity_decode 后出现奇怪的字符 (�),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5301243/

10-14 17:13
查看更多