繁体   English   中英

使用 override_function 将 utf-8 添加到所有 htmlenteties 调用

[英]using override_function to add utf-8 to all of htmlenteties calls

我有一个脚本,我想将其更改为波斯语,但该脚本是由我的同事编写的,他使用没有utf-8 htmlentities作为参数。

我决定使用override_functionrunkit ,我设法在我的 php 上安装了runkit并且它可以工作,但无法弄清楚如何更改它

htmlentities(LABEL__MAIN_INDEX_ADMIN, ENT_QUOTES)

htmlentities(LABEL__MAIN_INDEX_ADMIN, ENT_QUOTES , "UTF-8")

我知道我可以使用覆盖来更改 htmlentities,所以当我调用它时 utf-8 将被自动添加! 请帮我

我找到了答案!

runkit_function_copy('htmlentities','htmlentities2'); runkit_function_redefine ('htmlentities', '$string,$compat=NULL,$enc="UTF-8"', 'return htmlentities2($string,$compat,$enc);');

这就像魅力一样! 不管怎么说,还是要谢谢你 !

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM