它适用于htmlentities.但是你需要确保使用正确的字符集作为htmlentities'默认字符集ISO 8859-1不包含该字符; 但ISO 8859-15例如:
var_dump(htmlentities("\xA4", ENT_COMPAT, 'ISO-8859-15') === '€'); // bool(true)
Run Code Online (Sandbox Code Playgroud)
这"\xA4"将导致字节0xA4,即€ISO 8859-15中的代码.
因此,请确保使用包含该字符的字符集.