简体   繁体   English

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

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

I have an script that i want to change to Persian but this script has written by my colleague and he used htmlentities without utf-8 as argument.我有一个脚本,我想将其更改为波斯语,但该脚本是由我的同事编写的,他使用没有utf-8 htmlentities作为参数。

I decided to use override_function and runkit , i managed to install runkit on my php and it works but cant figure out how to change this我决定使用override_functionrunkit ,我设法在我的 php 上安装了runkit并且它可以工作,但无法弄清楚如何更改它

htmlentities(LABEL__MAIN_INDEX_ADMIN, ENT_QUOTES)

to

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

i know that i can use override to change htmlentities so when i call it utf-8 will be added automatically !我知道我可以使用覆盖来更改 htmlentities,所以当我调用它时 utf-8 将被自动添加! please help me请帮我

i found the answer !我找到了答案!

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

this works like charm !!这就像魅力一样! thanks anyway !不管怎么说,还是要谢谢你 !

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

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