html_实体_在json、文本字段和div中解码
我有一个构建json文件的函数。这是一个wordpress函数,但我认为这与问题无关 功能html_实体_在json、文本字段和div中解码,json,html-encode,Json,Html Encode,我有一个构建json文件的函数。这是一个wordpress函数,但我认为这与问题无关 功能 foreach ($posts as $post) { $titles[] = apply_filters('the_title', html_entity_decode($post->post_title)); } $content = json_encode( $titles ); 在json文件中,符号变为& 在twitter的typeahead div中,符号变成了& 在
foreach ($posts as $post) {
$titles[] = apply_filters('the_title', html_entity_decode($post->post_title));
}
$content = json_encode( $titles );
- 在json文件中,符号变为
&代码>
- 在twitter的typeahead div中,符号变成了
&
- 在文本字段中,符号AND变为
&代码>
html\u实体解码($post->post\u title,ENT\u COMPAT,'UTF-8')
同时删除html\u entity\u decode
,但这并没有解决问题
这里的所有帖子都建议我应该使用
html\u entity\u decode
,所以我有点不明白为什么它不起作用。看来这毕竟是一个与Wordpress相关的问题。。。我删除了apply\u filters
函数,之后html\u entity\u decode
按预期工作