dpj775835868 2015-04-27 09:17
浏览 20
已采纳

PHP; 通过include / require [复制]传递UTF-8字符串

This question already has an answer here:

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>
  • 写回答

2条回答 默认 最新

  • douyinghuo8874 2015-04-27 09:20
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 哪个tomcat中startup一直一闪而过 找不出问题
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网