【发布时间】:2020-03-09 02:30:57
【问题描述】:
我的问题是我必须在 php 中添加标签,以便在其中放置一些带有伪元素 span: before 和 content: 'text' 的样式,其中我有多种语言的翻译。
当然,已经添加,并且文件上的其余特殊字符正确显示。我的问题只是 .我还尝试了“header('Content-Type:text/html; charset = utf-8');”没有任何变化。
问题是没有正确读取特殊字符为“í”或“ç”,甚至添加了utf8_decode。
这里是我已经声明要翻译的单词的php代码
$textoProtecciones = utf8_decode ($trEstatico->_("Protecciones"));
$textoCaracteristicas = utf8_decode ($trEstatico->_("Características"));
$textoCortes_Negativo = utf8_decode ($trEstatico->_("Negativo"));
这里是php中一个标签中的css样式
<style>
@media (max-width: 768px) {
#owlcomparativatable .owl-item.active.center .item-table .clear.clear_third span:before {
content: '<?php echo $textoProtecciones;?>';
}
#owlcomparativatable .owl-item.active.center .item-table .clear.clear_fourth span:before {
content: '<?php echo $textoCaracteristicas;?>';
}
#owlcomparativatable .owl-item.active.center ul.cortes li.features_tablet:first-child span:before {
content: '<?php echo $textoCortes_Negativo;?>';
}
</style>
但是,即使所有内容都已正确声明,我仍会在屏幕上看到“Características”。即使在控制台代码中也没有正确读取“í”的 utf8 代码,显示如下:
#owlcomparativatable .owl-item.active.center .item-table .clear.clear_fourth span:before {
content: 'Características';
}
有人可以帮我解决这个问题吗?
【问题讨论】:
-
您是否在 html 模板的头部设置了
<meta charset="UTF-8">? -
当然, 已添加。其实其余的特殊字符都显示正确,只是php中中的这句话内容显示不正确。
标签: php html css pseudo-element css-content