[英]using override_function to add utf-8 to all of htmlenteties calls
我有一個腳本,我想將其更改為波斯語,但該腳本是由我的同事編寫的,他使用沒有utf-8
htmlentities
作為參數。
我決定使用override_function
和runkit
,我設法在我的 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.