【问题标题】:How to prevent double quotes on HTML entities from string?如何防止字符串中 HTML 实体的双引号?
【发布时间】:2018-01-16 21:06:42
【问题描述】:

我正在使用 Symfony 1.4,在 action 中有一个字符串,并在 variables 中设置这个字符串:

<div class='paging_links' name='initiatives'>
    <span class='active' name='1'>1</span> 
    <span class='' name='2'>2</span> 
</div>

然后在 template 中,转换 &lt;?php echo html_entity_decode($pagination) ?&gt; 产生以下内容:

<div class="'paging_links'" name="'initiatives'">
     <span class="'active'" name="'1'">1</span> 
     <span class="''" name="'2'">2</span> 
</div>

但我需要不带双引号的类名。我怎样才能做到这一点?

【问题讨论】:

    标签: php symfony-1.4


    【解决方案1】:

    我解决了 html_entity_decode($string, ENT_QUOTES | ENT_XML1, 'UTF-8')

    【讨论】:

      猜你喜欢
      • 2013-04-19
      • 2014-09-20
      • 1970-01-01
      • 2014-09-05
      • 1970-01-01
      • 1970-01-01
      • 2014-11-28
      • 2014-11-27
      • 1970-01-01
      相关资源
      最近更新 更多