Home > Backend Development > PHP Tutorial > Modify the encoding in the server during PHP development

Modify the encoding in the server during PHP development

WBOY
Release: 2016-07-29 09:09:39
Original
1091 people have browsed it

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>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template