中文处理工具函数
<?
/* 中文处理工具函数
--- 空格 ---
string GBspace(string) --------- 每个中文字之间加空格
string GBunspace(string) ------- 每个中文字之间的空格清除
string clear_space(string) ------- 用来清除多余的空格
--- 转换 ---
string GBcase(string,offset) --- 将字符串内的中英文字转换大小写
offset : "upper" - 字符串全转为大写 (strtoupper)
"lower" - 字符串全转为小写 (strtolower)
"ucwords" - 将字符串每个字第一个字母改大写 (ucwords)
"ucfirst" - 将字符串第一个字母改大写 (ucfirst)
string GBrev(string) ----------- 颠倒字符串
--- 文字检查 ---
int GB_check(string) ----------- 检查字符串内是否有 GB 字,有会返回 true,
否则会返回false
int GB_all(string) ------------- 检查字符串内所有字是否有 GB 字,是会返回 true,
否则会返回false
int GB_non(string) ------------- 检查字符串内所有字并不是 GB 字,是会返回 true,
否则会返回false
int GBlen(string) -------------- 返回字符串长度(中文字只计一字母)
--- 查找、取代、提取 ---
int/array GBpos(haystack,needle,[offset]) ---- 查找字符串 (strpos)
offset : 留空 - 查找第一个出现的位置
int - 由该位置搜索出现的第一个位置
"r" - 查找最后一次出现的位置 (strrpos)
"a" - 将所有查找到的字储存为数组(返回 array)
string GB_replace(needle,str,haystack) -- 查找与取代字符串 (str_replace)
string GB_replace_i(needle,str_f,str_b,haystack) -- 不检查大小写查找与取代字符串
needle - 查找字母
str - 取代字母 ( str_f - 该字母前, str_b 该字母后)
haystack - 字符串
string GBsubstr(string,start,[length]) -- 从string提取出由开始到结尾或长度
length的字符串。
中文字只计一字母,可使用正负数。
string GBstrnear(string,length) -- 从 string提取最接近 length的字符串。
length 中 中文字计2个字母。
--- 注意 ---
如使用由 Form 返回的字符串前,请先替字符串经过 stripslashes() 处理,除去多余的 \ 。
用法:在原 PHP 代码内加上:
include ("GB.inc");
即可使用以上工具函数。
*/
function GBlen($string) {
$l = strlen($string);
$ptr = 0;
$a = 0;
while ($a < $l) {
$ch = substr($string,$a,1);
$ch2 = substr($string,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
$ptr++;
$a += 2;
} else {
$ptr++;
$a++;
} // END IF
} // END WHILE
return $ptr;
}
function GBsubstr($string,$start,$length) {
if (!is_int($length) && $length != "") {
return "错误:length 值错误(必须为数值)。<br>";
} elseif ($length == "0") {
return "";
} else {
$l = strlen($string);
$a = 0;
$ptr = 0;
$str_list = array();
$str_list2 = array();
while ($a < $l) {
$ch = substr($string,$a,1);
$ch2 = substr($string,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
$str_list[$ptr] = $a;
$str_list2[$ptr] = $a+1;
$ptr++;
$a += 2;
} else {
$str_list[$ptr] = $a;
$str_list2[$ptr] = $a;
$ptr++;
$a++;
} // END IF
} // END WHILE
if ($start > $ptr || -$start > $ptr) {
return;
} elseif ($length == "") {
if ($start >= 0) { // (text,+)
return substr($string,$str_list[$start]);
} else { // (test,-)
return substr($string,$str_list[$ptr + $start]);
}
} else {
if ($length > 0) { // $length > 0
if ($start >= 0) { // (text,+,+)
if (($start + $length) >= count($str_list2)) {
return substr($string,$str_list[$start]);
} else { //(text,+,+)
$end = $str_list2[$start + ($length - 1)] - $str_list[$start] +1;
return substr($string,$str_list[$start],$end);
}
} else { // (text ,-,+)
$start = $ptr + $start;
if (($start + $length) >= count($str_list2)) {
return substr($string,$str_list[$start]);
} else {
$end = $str_list2[$start + ($length - 1)] - $str_list[$start] +1;
return substr($string,$str_list[$start],$end);
}
}
} else { // $length < 0
$end = strlen($string) - $str_list[$ptr+$length];
if ($start >= 0) { // (text,+,-) {
return substr($string,$str_list[$start],-$end);
} else { //(text,-,-)
$start = $ptr + $start;
return substr($string,$str_list[$start],-$end);
}
} // END OF LENGTH > / < 0
}
} // END IF
}
function GB_replace($needle,$string,$haystack) {
$l = strlen($haystack);
$l2 = strlen($needle);
$l3 = strlen($string);
$news = "";
$skip = 0;
$a = 0;
while ($a < $l) {
$ch = substr($haystack,$a,1);
$ch2 = substr($haystack,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
if (substr($haystack,$a,$l2) == $needle) {
$news .= $string;
$a += $l2;
} else {
$news .= $ch.$ch2;
$a += 2;
}
} else {
if (substr($haystack,$a,$l2) == $needle) {
$news .= $string;
$a += $l2;
} else {
$news .= $ch;
$a++;
}
} // END IF
} // END WHILE
return $news;
}
function GB_replace_i($needle,$str_f,$str_b,$haystack) {
$l = strlen($haystack);
$l2 = strlen($needle);
$l3 = strlen($string);
$news = "";
$skip = 0;
$a = 0;
while ($a < $l) {
$ch = substr($haystack,$a,1);
$ch2 = substr($haystack,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
if (GBcase(substr($haystack,$a,$l2),"lower") == GBcase($needle,"lower")) {
$news .= $str_f . substr($haystack,$a,$l2) . $str_b;
$a += $l2;
} else {
$news .= $ch.$ch2;
$a += 2;
}
} else {
if (GBcase(substr($haystack,$a,$l2),"lower") == GBcase($needle,"lower")) {
$news .= $str_f . substr($haystack,$a,$l2) . $str_b;
$a += $l2;
} else {
$news .= $ch;
$a++;
}
} // END IF
} // END WHILE
return $news;
}
function GBpos($haystack,$needle,$offset) {
if (!is_int($offset)) {
$offset = strtolower($offset);
if ($offset != "" && $offset != "r" && $offset != "a") {
return "错误:offset 值错误。<br>";
}
}
$l = strlen($haystack);
$l2 = strlen($needle);
$found = false;
$w = 0; // WORD
$a = 0; // START
if ($offset == "" || $offset == "r") {
$atleast = 0;
$value = false;
} elseif ($offset == "a") {
$value = array();
$atleast = 0;
} else {
$value = false;
$atleast = $offset;
}
while ($a < $l) {
$ch = substr($haystack,$a,1);
$ch2 = substr($haystack,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40") && $skip == 0) {
if (substr($haystack,$a,$l2) == $needle) {
if ($offset == "r") {
$found = true;
$value = $w;
} elseif ($offset == "a") {
$found = true;
$value[] = $w;
} elseif (!$value) {
if ($w >= $atleast) {
$found = true;
$value = $w;
}
}
}
$a += 2;
} else {
if (substr($haystack,$a,$l2) == $needle) {
if ($offset == "r") {
$found = true;
$value = $w;
} elseif ($offset == "a") {
$found = true;
$value[] = $w;
} elseif (!$value) {
if ($w >= $atleast) {
$found = true;
$value = $w;
}
}
}
$a++;
}
$w++;
} // END OF WHILE
if ($found) {
return $value;
} else {
return $false;
}
// } // END OF WHILE
}
function GBrev($text) {
$news = "";
$l = strlen($text);
$GB = 0;
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40") && $skip == 0) {
$a += 2;
$news = $ch . $ch2 . $news;
} else {
$news = $ch . $news;
$a++;
}
}
return $news;
}
function GB_check($text) {
$l = strlen($text);
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
return true;
} else {
return false;
}
}
}
function GB_all ($text) {
$l = strlen($text);
$all = 1;
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
$a += 2;
} else {
$a++;
$all = 0;
}
}
if ($all == 1) {
return true;
} else {
return false;
}
}
function GB_non ($text) {
$l = strlen($text);
$all = 1;
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
$a += 2;
$all = 0;
} else {
$a++;
}
}
if ($all == 1) {
return true;
} else {
return false;
}
}
function GBcase ($text,$case) {
$case = strtolower($case);
if ($case != "upper" && $case != "lower" && $case != "ucwords" && $case != "ucfirst") {
return "函数用法错误。 $case";
} else {
$ucfirst = 0;
$ucwords = 0;
$news = "";
$l = strlen($text);
$GB = 0;
$english = 0;
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
if ($GB == 0 && ord($ch) >= HexDec("0x81")) {
$GB = 1;
$english = 0;
$news .= $ch;
$ucwords = 0;
} elseif ($GB == 1 && ord($ch) >= HexDec("0x40") && $english == 0) {
$news .= "$ch";
$ucwords = 0;
$GB = 0;
} else {
if ($case == "upper") {
$news .= strtoupper($ch);
} elseif ($case == "lower") {
$news .= strtolower($ch);
} elseif ($case == "ucwords") {
if ($ucwords == 0) {
$news .= strtoupper($ch);
} else {
$news .= strtolower($ch);
}
$ucwords = 1;
} elseif ($case == "ucfirst") {
if ($ucfirst == 0) {
$news .= strtoupper($ch);
$ucfirst = 1;
} else {
$news .= strtolower($ch);
$ucfirst = 1;
}
} else {
$news .= $ch;
}
if ($ch == " " || $ch == "\n") {
$ucwords = 0;
}
$english = 1;
$GB = 0;
}
$a++;
} // END OF while
return $news;
} // end else
}
function GBspace ($text) {
$news = "";
$l = strlen($text);
$GB = 0;
$english = 0;
$a = 0;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (!($ch == " " && $ch2 == " ")) {
if ($GB == 0) {
if (ord($ch) >= HexDec("0x81")) {
if ($english == 1) {
if ((substr($text,$a-1,1) == " ") || (substr($text,$a-1,1) == "\n")) {
$news .= "$ch";
} else {
$news .= " $ch";
}
$english = 0;
$GB = 1;
} else {
$GB = 1;
$english = 0;
$news .= $ch;
}
} else {
$english = 1;
$GB = 0;
$news .= $ch;
}
} else {
if (ord($ch) >= HexDec("0x40")) {
if ($english == 0) {
if ((substr($text,$a+1,1) == " ")|| (substr($text,$a+1,1) == "\n")) {
$news .= "$ch";
} else {
$news .= "$ch ";
}
} else {
$news .= " $ch";
}
} else {
$english = 1;
$news .= "$ch";
}
$GB = 0;
}
}
$a++;
} // END OF while
// Chk 1 & last is space
$l = strlen($news);
if (substr($news,0,1) == " ") {
$news = substr($news,1);
}
$l = strlen($news);
if (substr($news,$l-1,1) == " ") {
$news = substr($news,0,$l-1);
}
return $news;
}
function GBunspace($text) {
$news = "";
$l = strlen($text);
$a = 0;
$last_space = 1;
while ($a < $l) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
$ch3 = substr($text,$a+2,1);
if (($a + 1) == $l ) {
$last_space = 1;
}
if ($ch == " ") {
if ($last_space == 0) {
if (ord($ch2) >= HexDec("0x81") && ord($ch3) >= HexDec("0x40")) {
if ($chi == 0) {
$news .= " ";
$last_space = 1;
}
$chi=1;
} elseif ($ch2 != " ") {
$news .= " ";
$chi = 0;
$last_space = 1;
}
}
} else {
if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
$chi = 1;
$a++;
$news .= $ch . $ch2;
$last_space = 0;
} else {
$chi = 0;
$news .= $ch;
$last_space = 0;
}
}
$a++;
}
// Chk 1 & last is space
$l = strlen($news);
if (substr($news,0,1) == " ") {
$news = substr($news,1);
}
$l = strlen($news);
if (substr($news,$l-1,1) == " ") {
$news = substr($news,0,$l-1);
}
return $news;
} // END OF Function
function GBstrnear($text,$length) {
$tex_len = strlen($text);
$a = 0;
$w = "";
while ($a < $tex_len) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if (GB_all($ch.$ch2)) {
$w .= $ch.$ch2;
$a=$a+2;
} else {
$w .= $ch;
$a++;
}
if ($a == $length || $a == ($length - 1)) {
$a = $tex_len;
}
}
return $w;
} // END OF FUNCTION
function clear_space($text) {
$t = "";
for ($a=0;$a<strlen($text);$a++) {
$ch = substr($text,$a,1);
$ch2 = substr($text,$a+1,1);
if ($ch == " " && $ch2 == " ") {
} else {
$t .= $ch;
}
}
return $t;
}
?>
与JSP相比,PHP具学习简单、运行更新快、安全性高等特点,所以在编写动态网页时,PHP是首选。大家都知道,PHP边学的程序只能在服务器端运行,所以要运行你编写的程序,除了下载PHP程序编译器外,还要下载一个web服务器软件。如果是用微软的IIS,PHP的性能是不能完全发挥出来的。只要Apache和PHP搭配才是最家方案,这种优势在Linux下尤为突出,下面我们一起来下载安装:
1. Apache2
先下载安装Apache2,可以到其官方网站(http://www.apache.org)下载。
下载地址:http://archive.apache.org/dist/httpd/binaries/win32/
下载文件为:apache_2.0.53-win32-x86-no_ssl.exe ,双击安装,如下图:
图一. 安装Apache是所注意的地方
打开IE浏览器,在地址栏里输入 http://localhost 后点回车,如果可以看到下图内容,说明安装正确
打开安装地址..\Apache2\conf中的文件httpd.conf,找到DocumentRoot "C:/Program Files/Apache2/htdocs",修改路径为你站点所在位置,如DocumentRoot "D:/web"。注意:“\”在此要改为“/”。保存httpd.conf文件并重起Apache即可。如下图所示:
2. PHP
首先我们到PHP官方网站(http://www.php.net)下载PHP5。
下载地址:http://www.php.net/get/php-5.1.0RC1-Win32.zip/from/a/mirror
下载文件为:php-5.1.0RC1-Win32.zip。解压后改名为php,考入C盘根目录下即可。
下面我们设置Apache和PHP,让他们能一起工作。打开C:\php中的文件install.txt,找到Example 2-5. PHP and Apache 2.0 as CGI一行,即适应于 Apache 2.0 ,将起后面的语句复制到httpd.conf文件最后,保存httpd.conf文件并重起Apache即可。
要复制的语句如下:
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
# For PHP 4
Action application/x-httpd-php "/php/php.exe"
# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"
由于PHP 5 不再绑定 MySQL 客户端库例,如我们在运行PHP程序时出现
Fatal error: Call to undefined function mysql_connect()
大家不要着急,我们手动在 php.ini 中激活 php_mysql.dll 扩展库,就可以了,方法很简单,将C:\php中的php.ini-dist该名为php.ini,找到下列语句
......
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
.....
首先是去掉;extension=php_mysql.dll前面的“;”(;为注释),第二步是将C:\php\ext中的php_mysql.dll复制到C:\WINDOWS(C:\WINNT)中即可,或者将环境变量的PATH值增加;C:\php\ext。保存并重起Apache。
<?
phpinfo();
?>
运行后如果显示如下图,说明设置正确
文章录入 |
错误信息说明从 PHP 4.2.0 开始,
PHP 将随文件信息数组一起返回一个对应的错误代码。该代码可以在文件上传时生成的文件数组中的 error 字段中被找到,
也就是 $_FILES["userfile"]["error"]。
首先删除不必要的文件节省空间。凡是以_开头的文件如_samples,_testcases和一些用不到的.asp、.jsp、.cfm文件统统干掉。
2修改fckconfig.js
FCKConfig.AutoDetectLanguage = true ;//是否自动检测语言
FCKConfig.DefaultLanguage = 'zh-cn' ;//设置语言
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;//设置皮肤
FCKConfig.TabSpaces = 1 ;//tab是否有效
FCKConfig.ToolbarStartExpanded = true ;//编辑工具条是否出现,等点“展开工具栏”时才出现
FCKConfig.FontNames = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;//添加中文字体
修改FCKeditor\editor\css\fck_editorarea.css
设置默认字体及大小
body, td
{
font-family: Arial, Verdana, Sans-Serif;
font-size: 14px;
}
3关于文件上传的设置
修改fckconfig.js
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php
修改fckeditor\editor\filemanager\browser\default\connectors\php
$Config['Enabled'] = true ;
$Config['UserFilesPath'] = '/UserFiles/' ;//设置上传的文件夹,可自己指定
修改fckeditor\editor\filemanager\upload\php
$Config['Enabled'] = true ;
$Config['UseFileType'] = true ;
$Config['UserFilesPath'] = '/UserFiles/' ;//同上要一样
4引入在线编辑器时只需
<?php
include("fckeditor/fckeditor.php") ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;//实例化
$oFCKeditor->BasePath = 'fckeditor/';//这个路径一定要和上面那个引入路径一致,否则会报错:找不到fckeditor.html页面
//$oFCKeditor->Value = '' ;默认值
$oFCKeditor->Width = '100%' ; //宽度
$oFCKeditor->Height = '300' ; //fck
$oFCKeditor->Create() ;
?>
=================
取得数据
$sValue = addslashes( $_POST['FCKeditor1'] ) ;
显示数据stripslashes,原因是addslashes函数加'加上了\'而stripslashes取还原由addslashes处理的数.
foreach()有两种用法
1: foreach(array as $value)
{
表达式;
}
这里的array是你要遍历的数组名,每次循环中,array数组的当前元素的值被赋给$value,
并且数组内部的下标向下移一步,也就是下次循环回得到下一个元素
2:foreach(array_name as $key => $value)
{
表达式
}
这里跟第一种方法的区别就是多了个$key,也就是除了把当前元素的值赋给$value外,当前元素的键值也会在每次循环中被赋给变量$key。键值可以是下标值,也可以是字符串。比如book[0]=1中的“0”,book[id]="001"中的“id”.
其实两种的效率不相上下.
相关文章
js URLdecode()与urlencode方法支持中文解码
下面来介绍在js中来利用urlencode对中文编码与接受到数据后利用URLdecode()对编码进行解码,有需要学习的机友可参考参考。 代码如下 复制代码 ...2016-09-20- eval函数在php中是一个函数并不是系统组件函数,我们在php.ini中的disable_functions是无法禁止它的,因这他不是一个php_function哦。 eval()针对php安全来说具有很...2016-11-25
- 在php中eval是一个函数并且不能直接禁用了,但eval函数又相当的危险了经常会出现一些问题了,今天我们就一起来看看eval函数对数组的操作 例子, <?php $data="array...2016-11-25
Python astype(np.float)函数使用方法解析
这篇文章主要介绍了Python astype(np.float)函数使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下...2020-06-08- 这篇文章主要介绍了Python中的imread()函数用法说明,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-16
- 本文主要介绍了C# 中取绝对值的函数。具有很好的参考价值。下面跟着小编一起来看下吧...2020-06-25
- 下面小编就为大家带来一篇C#学习笔记- 随机函数Random()的用法详解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2020-06-25
- CREATE FUNCTION ChangeBigSmall (@ChangeMoney money) RETURNS VarChar(100) AS BEGIN Declare @String1 char(20) Declare @String2 char...2016-11-25
- 这篇文章主要介绍了C++中Sort函数详细解析,sort函数是algorithm库下的一个函数,sort函数是不稳定的,即大小相同的元素在排序后相对顺序可能发生改变...2022-08-18
Android开发中findViewById()函数用法与简化
findViewById方法在android开发中是获取页面控件的值了,有没有发现我们一个页面控件多了会反复研究写findViewById呢,下面我们一起来看它的简化方法。 Android中Fin...2016-09-20- strstr() 函数搜索一个字符串在另一个字符串中的第一次出现。该函数返回字符串的其余部分(从匹配点)。如果未找到所搜索的字符串,则返回 false。语法:strstr(string,search)参数string,必需。规定被搜索的字符串。 参数sea...2013-10-04
关于Mysql中文乱码问题该如何解决(乱码问题完美解决方案)
最近两天做项目总是被乱码问题困扰着,这不刚把mysql中文乱码问题解决了,下面小编把我的解决方案分享给大家,供大家参考,也方便以后自己查阅。首先:用show variables like “%colla%”;show varables like “%char%”;这两条...2015-11-24- 这篇文章主要介绍了微信小程序 二维码生成工具 weapp-qrcode详解,教大家如何在项目中引入weapp-qrcode.js文件,通过实例代码给大家介绍的非常详细,需要的朋友可以参考下...2021-10-23
Elasticsearch工具cerebro的安装与使用教程
这篇文章主要介绍了Elasticsearch工具cerebro的安装与使用教程,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-08PHP函数分享之curl方式取得数据、模拟登陆、POST数据
废话不多说直接上代码复制代码 代码如下:/********************** curl 系列 ***********************///直接通过curl方式取得数据(包含POST、HEADER等)/* * $url: 如果非数组,则为http;如是数组,则为https * $header:...2014-06-07- Foreach 函数(PHP4/PHP5)foreach 语法结构提供了遍历数组的简单方式。foreach 仅能够应用于数组和对象,如果尝试应用于其他数据类型的变量,或者未初始化的变量将发出错误信息。...2013-09-28
- 这篇文章主要介绍了C#读取中文文件出现乱码的解决方法,涉及C#中文编码的操作技巧,非常具有实用价值,需要的朋友可以参考下...2020-06-25
- free函数是释放之前某一次malloc函数申请的空间,而且只是释放空间,并不改变指针的值。下面我们就来详细探讨下...2020-04-25
- 我们自己鼓捣mysql时,总免不了会遇到这个问题:插入中文字符出现乱码,虽然这是运维先给配好的环境,但是在自己机子上玩的时候咧,总得知道个一二吧,不然以后如何优雅的吹牛B。...2015-03-15
- 在debian环境下,彻底解决mysql无法插入和显示中文的问题Linux下Mysql插入中文显示乱码解决方案mysql -uroot -p 回车输入密码进入mysql查看状态如下:默认的是客户端和服务器都用了latin1,所以会乱码。解决方案:mysql>use...2013-10-04