PHP乱码来源分析
PHP项目出现乱码,原因就是软件之间,模板之间的编码有差异,不相同:
- 新建".html", ".php" , ".tpl" , ."js" , ".css"等文件使用utf8统一的编码格式;
- 在开发工具中设置默认新建文件时的编码格式;
mysql_query("set character set 'utf8'"); //读库
mysql_query("set names 'utf8'"); //写库
- default-character-set=utf8 //MySQL配置文件"my.ini"编码设置
- init-connect=/'SET NAMES utf8/' //MySQL配置文件"my.ini"编码设置
- collation_server=utf8_unicode_ci //MySQL配置文件"my.ini"编码设置
- character_set_server=utf8 //MySQL配置文件"my.ini"编码设置
- default_charset = "UTF-8" //php配置文件"php.ini"编码设置
- header(“Content-Type: text/html; charset=utf-8″); //php 文件输出头
- header("Cache-Control:no-cache"); //php文件输出头
//html页面中使用的编码
- 在phpMyAdmin中修改mysql中数据库,数据表及数据字段的字符编码格式; //编码设为:utf8_general_ci
- 数据库执行语句 :CREATEDATABASE`dbname`DEFAULTCHARACTERSETutf8 COLLATE utf8_general_ci;
- 待续...
补充:
# Lang-abbvCharset Language
#---------------------------------
en ISO-8859-1 English
UTF-8 utf8 UTF-8
Unicode ucs Unicode
th Cp874 Thai
ja SJIS Japanese
ko Cp949 Korean
zh Cp950 Chinese-Traditional
zh-cn GB2312 Chinese-Simplified
zh-tw Cp950 Chinese
cs ISO-8859-2 Czech
hu ISO-8859-2 Hungarian
hr ISO-8859-2 Croation
pl ISO-8859-2 Polish
ro ISO-8859-2 Romanian
sr ISO-8859-2 Serbian
sk ISO-8859-2 Slovak
sl ISO-8859-2 Slovenian
sq ISO-8859-2 Albanian
bg ISO-8859-5 Bulgarian
be ISO-8859-5 Byelorussian
mk ISO-8859-5 Macedonian
ru ISO-8859-5 Russian
uk ISO-8859-5 Ukrainian
ca ISO-8859-1 Catalan
de ISO-8859-1 German
da ISO-8859-1 Danish
fi ISO-8859-1 Finnish
fr ISO-8859-1 French
es ISO-8859-1 Spanish
is ISO-8859-1 Icelandic
it ISO-8859-1 Italian
nl ISO-8859-1 Dutch
no ISO-8859-1 Norwegian
pt ISO-8859-1 Portuguese
sv ISO-8859-1 Swedish
af ISO-8859-1 Afrikaans
eu ISO-8859-1 Basque
fo ISO-8859-1 Faroese
gl ISO-8859-1 Galician
ga ISO-8859-1 Irish
gd ISO-8859-1 Scottish
mt ISO-8859-3 Maltese
eo ISO-8859-3 Esperanto
el ISO-8859-7 Greek
tr ISO-8859-9 Turkish
he ISO-8859-8 Hebrew
iw ISO-8859-8 Hebrew
ar ISO-8859-6 Arabic
et ISO-8859-1 Estonian
lv ISO-8859-2 Latvian
lt ISO-8859-2 Lithuanian

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Recently, many friends have asked me what to do if WPSOffice cannot open PPT files. Next, let us learn how to solve the problem of WPSOffice not being able to open PPT files. I hope it can help everyone. 1. First open WPSOffice and enter the homepage, as shown in the figure below. 2. Then enter the keyword "document repair" in the search bar above, and then click to open the document repair tool, as shown in the figure below. 3. Then import the PPT file for repair, as shown in the figure below.

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

CrystalDiskInfo is a software used to check computer hardware devices. In this software, we can check our own computer hardware, such as reading speed, transmission mode, interface, etc.! So in addition to these functions, how to use CrystalDiskInfo and what exactly is CrystalDiskInfo? Let me sort it out for you! 1. The Origin of CrystalDiskInfo As one of the three major components of a computer host, a solid-state drive is the storage medium of a computer and is responsible for computer data storage. A good solid-state drive can speed up file reading and affect consumer experience. When consumers receive new devices, they can use third-party software or other SSDs to

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

Many users are using the Adobe Illustrator CS6 software in their offices, so do you know how to set the keyboard increment in Adobe Illustrator CS6? Then, the editor will bring you the method of setting the keyboard increment in Adobe Illustrator CS6. Interested users can take a look below. Step 1: Start Adobe Illustrator CS6 software, as shown in the figure below. Step 2: In the menu bar, click the [Edit] → [Preferences] → [General] command in sequence. Step 3: The [Keyboard Increment] dialog box pops up, enter the required number in the [Keyboard Increment] text box, and finally click the [OK] button. Step 4: Use the shortcut key [Ctrl]

When we use the Edge browser, sometimes incompatible software attempts to be loaded together, so what is going on? Let this site carefully introduce to users how to solve the problem of trying to load incompatible software with Edge. How to solve an incompatible software trying to load with Edge Solution 1: Search IE in the start menu and access it directly with IE. Solution 2: Note: Modifying the registry may cause system failure, so operate with caution. Modify registry parameters. 1. Enter regedit during operation. 2. Find the path\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Micros

PhotoshopCS is the abbreviation of Photoshop Creative Suite. It is a software produced by Adobe and is widely used in graphic design and image processing. As a novice learning PS, let me explain to you today what software photoshopcs5 is and how to use photoshopcs5. 1. What software is photoshop cs5? Adobe Photoshop CS5 Extended is ideal for professionals in film, video and multimedia fields, graphic and web designers who use 3D and animation, and professionals in engineering and scientific fields. Render a 3D image and merge it into a 2D composite image. Edit videos easily

Recently, many friends have asked me how to delete recently opened files in Adobe Reader XI. Next, let us learn how to delete recently opened files in Adobe Reader XI. I hope it can help everyone. Step 1: First, use the "win+R" shortcut key to open the run, enter "regedit", and press Enter to open it, as shown in the picture. Step 2: After entering the new interface, click "HKEY_CURRENT_USERSoftwareAdobeAcrobatReader11.0AVGeneralcRecentFiles" on the left, select "c1", right-click and select the "Delete" option, as shown in the figure. Step 3: Then pop up
