Home > Article > Backend Development > Modify the encoding in the server during PHP development
Modify the encoding in the server during PHP development
1 Apache opens the web page with garbled characters. The method to modify the default character set of apache is as follows:
Open the apache configuration file httpd.conf. The apache configuration file path under Windows is generally D:Program FilesApache Software FoundationApache2.2conf (default path installation)
Find AddDefaultCharset utf-8 and modify it to AddDefaultCharset gbk;
Then restart the apache service.
2 Sometimes in php development, cross-class calls are required. The first choice is to request "xxx.php";
<span><em>header("Content-type:text/html;charset=utf-8"); //设置某人字符集 </em></span><span><em> require "User.php"; //必须要应用某个class才能使用 //请求调用类的请求 </em></span><span><em>$db=new User(); //实例化对象 </em></span><span><em>$db->testone(); //调用对象的方法</em></span>
The above introduces how to modify the coding in the server during PHP development, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.