Two ways to set the encoding of PHP load page, PHP load page encoding _php tutorial

Source: Internet
Author: User

Two ways to set the encoding of PHP load page, PHP load page encoding


Two ways to set page encoding when loading pages in PHP

1: Output META tag:

1, in the PHP MVC controller or the PHP page echo ' ;
2. On a PHP page or HTML page

2: Using the header function

Inside the Controller or page header ("content-type:text/html; Charset=utf-8 ");


PHP How to set the code

mysql_connect ("localhost", "root", "");//Connect database three parameters, Web server, database account and password. \

mysql_select_db ("Lyb");//Select Database
mysql_query ("Set names gb2312")//settings transfer use the gb2312 character set to prevent garbled characters.
?>

Plus mysql_query ("Set names gb2312")//settings transfer use the gb2312 character set to prevent garbled characters.

PHP Page Coding Issues

Because your new page encoding is utf-8 even if you delete the encoding settings inside or utf-8
If you need a unified gb2312
1.DW when creating a new page Preferences select New page encoded as gb2312

2.ctrl+j re-modifying file encoding

PHP does not have coding problems except for database data because PHP does not have Chinese. As long as the page Setup problem

http://www.bkjia.com/PHPjc/852377.html www.bkjia.com true http://www.bkjia.com/PHPjc/852377.html techarticle two ways to set PHP Load page encoding method, PHP load page encoding php loading page when the page encoding two methods 1: Output META tag: 1, in the PHP MVC controller inside or ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.