0
如何'请'htmlentities()
不要转换某些符号?例如,如何不不使用htmlentities()来转换某些符号?
PHP,
<?php echo htmlentities(file_get_contents('fonts.css'),ENT_QUOTES);?>
fonts.css,
@font-face {
font-family: 'ChunkFiveRoman';
src: url('chunkfive-webfont.eot'); /* EOT file for IE */
src: local('☺'), url('chunkfive-webfont.ttf') format('truetype'); /* TTF file for CSS3 browsers */
}
结果,
@font-face {
font-family: 'ChunkFiveRoman';
src: url('chunkfive-webfont.eot'); /* EOT file for IE */
src: local('�'), url('chunkfive-webfont.ttf') format('truetype'); /* TTF file for CSS3 browsers */
}
我想要保持 '☺',因为它是,但不转换它变成' º'。
可能吗?
'htmlentities'不能像那样工作,所以问题在其他地方。也许你的css文件是用utf-8编码的,但是你用单字节编码将它显示为HTML? – Jon 2012-01-18 17:23:55
谢谢乔恩。可能我以单字节编码的形式将css显示为HTML ......但现在似乎马里奥的答案可以正常工作。 – laukok 2012-01-18 17:32:53