PHP; 通过include / require [复制]传递UTF-8字符串
This question already has an answer here:
- UTF-8 all the way through 15 answers
I have the following function;
function generateFirstName(){
$firstNameArray = array("Thomáš ","Lukáš ");
$firstNameKey = mt_rand(0,1);
$firstName = $firstNameArray[$firstNameKey];
return $firstName;
}
When the function is called on the same page the UTF-8 format outputs fine, but when it is called from a functions.php (that is REQUIRED in the INCLUDED head.php) the UTF-8 format doesn-t arrive and i get the dreaded black diamond with white question mark.
What do I need to do to pass the strings?
</div>
此问题已经存在 这里有一个答案: p>
-
UTF-8一直到
15 answers
span>
li>
ul>
div>
我有以下功能; p>
function generateFirstName(){ $ firstNameArray = array(“Thomáš”,“Lukáš”); $ firstNameKey = mt_rand(0,1); $ firstName = $ firstNameArray [$ firstNameKey]; 返回$ firstName; pre>
当在同一页面上调用该函数时,UTF-8格式输出正常,但是当它从functions.php调用时(即 在INCLUDED head.php中需要UTF-8格式没有到达,我得到了可怕的黑钻石机智 h白色问号。 p>
传递字符串需要做什么? p> div>
Check every required or included files encoding. They all must be in UTF-8 to work together. You have to be sure about every file, that can be included from functions.php and other files.
Each file must be encoded in utf8