字符编码问题

WBOY
Release: 2016-06-23 14:25:07
Original
1027 people have browsed it

请问一个问题,我在php中插入一个数据insert into
但是这个插入的数据中是有特殊字符的,插入数据库中变成两条数据了(貌似是换行捣乱),请问给位能否在php服务端进行编码?
注:我用的是ascii这是客户端的规定


回复讨论(解决方案)

header("Content-type: text/html; charset=utf-8");

mysql_query("SET NAMES ascii");

header("Content-type: text/html; charset=utf-8");
$string = iconv('ASCII', 'UTF-8//IGNORE', $string);
mysql_query("SET NAMES utf8");
mysql_query("insert into...");

这是不可能吧?

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!