php ajax交互汉字乱码的问题解决方法
服务器端传送的数据仍是gb2312编码,客户端用js将汉字转变成utf8编码显示在页面
方法一json
一,服务器端json数据用php教程的iconv函数转换:iconv('gb2312', 'utf8', "被转换字符串,输出到浏览器");
客户端获取utf8数据,再转成gb2312:
function gb2utf8(data){//gb编码是,ie通过二进制码utf8->gbk转为中文
var glbencode = [];
gb2utf8_data = data;
execscript("gb2utf8_data = midb(gb2utf8_data, 1)", "vbscript");
var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g|>,"%$2%$1").replace(/%([a-z].)%(.{2})/g|>,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
while(++i<j)>
k=t.substring(0,4);
if(!glbencode[k]) {
gb2utf8_char = eval("0x"+k);
execscript("gb2utf8_char = chr(gb2utf8_char)", "vbscript");
glbencode[k]=escape(gb2utf8_char).substring(1,6);
}
t=glbencode[k]+t.substring(4);
}
gb2utf8_data = gb2utf8_char = null;
return unescape(t.join("%"));
}
二,header("content-type", "application/x-www-form-urlencoded; charset=gbk"); //输出头标,设置为gbk编码
三,在ajax请求数据前调用上面的方法指定请求使用的字符集:xmlhttp.setrequestheader( "content-type", "application/x-www-form-urlencoded;charset=gbk");
方案二
search.php
<?php
header("content-type: text/html; charset=gb2312");
include './search.htm';
?>
search.htm
php获取当前页面url地址及参数 要获取当前页面的完整地址我们要经过很多操作如HTTP或HTTPS php文件与路径 主机域名 查询参数最后就成了。<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>高级搜索</title>
</head>
<body>
<h3>高级搜索</h3>
<form method="post" action="">
学校类型:
<select name="schooltype">
<option value="">全部</option>
<option value="1">小学</option>
<option value="2">初中</option>
</select>
学校名称:
<select name="sid" id="sid">
<option value="">请选择学校</option>
</select>
</form>
<script type="text/网页特效">
function ajax(settings) {
var xhr = window.activexobject ? new activexobject("microsoft.xmlhttp") : new xmlhttprequest(), successed = false;
xhr.open(settings.type, settings.url);
if(settings.type == 'post')
xhr.setrequestheader('content-type', 'application/x-www-form-urlencoded');
xhr.send((!settings.cache ? 'time=' + new date().gettime() + '&' : '') + settings.data);
settings.loader();
settimeout(function() {
if(!successed) {
alert('resquest timeout!');
xhr.abort();
}
}, settings.timeout);
xhr.onreadystatechange = function() {
if (xhr.readystate == 4 && xhr.status == 200) {
settings.callback(xhr.responsetext.replace(/(^s*)|(s*$)/g, ""));
}
successed = true;
}
}
function a(t) {
ajax({
type: 'post',
url: 'ajax.php',
data: 'schooltype=' + t,
timeout: 8000,
cache: true,
loader: function() {},
callback: function(d) {
var arr = eval(d);
if(typeof(arr) == 'object') {
var obj, option;
document.getelementbyid('sid').innerhtml = '';
for(var i = 0; obj = arr; i ++) {
option = document.createelement('option');
option.value = obj[0];
option.innerhtml = txt2utf8(obj[1], '&#');
document.getelementbyid('sid').appendchild(option);
}
}
}
})
}
function txt2utf8(string, prefix){
for(var i=0,utf8=[];i<string.length;utf8.push((prefix||'u')+string.charcodeat(i++)));
return utf8.join('');
}
a(0);
</script>
</body>
</html>ajax.php
<?php
header("content-type: text/html; charset=gb2312");
$schooltype = !empty($_post['schooltype']) ? $_post['schooltype'] : 0;
switch($schooltype) {
case 0:
echo "[['40', '太平溪镇花栗包完全小学'],['41', '太平溪镇长岭黑龙江希望小学'],['42', '乐天溪镇初级中学'],['43', '乐天溪镇莲沱初级中学']]";
break;
case 1:
echo "[['40', '太平溪镇花栗包完全小学'],['41', '太平溪镇长岭黑龙江希望小学']]";
break;
case 2:
echo "[['42', '乐天溪镇初级中学'],['43', '乐天溪镇莲沱初级中学']]";
break;
default:
break;
}
?>
获取协议 - http
url的协议,可以读出在$ _server ['server_protocol']变量。
*/
echo $_server['server_protocol'];
/*
如果你检查值,可以发现,不只是http或https,但这样的字符串:http/1.1的
*/
$protocol = strpos(strtolower($_server['server_protocol']),'https') === false ? 'http' : 'https';
/*
获取主机域名*/
$host = $_server['http_host'];
/*
利用$ _server['script_name']获取除域名外的php文件与路径
*/
$script = $_server['script_name'];
//获取?后面查询参数
$params = $_server['query_string'];
//方法二
$uri = $_server['request_uri'];
//下面来看一个完整的获取当前url实例
$protocol = strpos(strtolower($_server['server_protocol']),'https') === false ? 'http' : 'https';
$host = $_server['http_host'];
$script = $_server['script_name'];
$params = $_server['query_string'];
$currenturl = $protocol . '://' . $host . $script . '?' . $params;
echo $currenturl;
<?php教程
/*
* 模板分页类,源于easp教程的数据库教程分页方法,算是easp分页的的php独立版
* 支持动态和静态分页方式
* * page([总记录数=1],[分页大小=20],[当前页=1],[显示页数=6],[分页参数='page'],[分页链接=当前页面],[是否静态=false])
* 动态:
* 简单用法:
* $page = new page(50);
* $page->setpager('zjj','<div class="newpager">共有{recordcount} 个商品 当前第 {pageindex} 页 / 共 {pagecount} 页 分页: {first}{prev} {list} {next}{last} 转到 {jump} 页</div>',array("listlong"=>"6","first"=>"首页","last"=>"尾页","prev"=>"上一页","next"=>"下一页","list"=>"第*页","jump"=>"select"));
* echo $page->getpager('zjj');
* 全参数用法:
* $page = new page(50,20,1,6,'page','prrr.php',false);
* $page->setpager('zjj','<div class="newpager">共有{recordcount} 个商品 当前第 {pageindex} 页 / 共 {pagecount} 页 分页: {first}{prev} {list} {next}{last} 转到 {jump} 页</div>',array("listlong"=>"6","first"=>"首页","last"=>"尾页","prev"=>"上一页","next"=>"下一页","list"=>"第*页","jump"=>"select"));
* echo $page->getpager('zjj');
* 静态:
* $page = new page(50,20,1,6,'page','prrr{page}.html',true);
* $page->setpager('zjj','<div class="newpager">共有{recordcount} 个商品 当前第 {pageindex} 页 / 共 {pagecount} 页 分页: {first}{prev} {list} {next}{last} 转到 {jump} 页</div>',array("listlong"=>"6","first"=>"首页","last"=>"尾页","prev"=>"上一页","next"=>"下一页","list"=>"第*页","jump"=>"select"));
* echo $page->getpager('zjj');
*/
class page {
private $page_size; //每页显示的条目数
private $total_size; //总条目数
private $current_page; //当前被选中的页
private $sub_pages; //每次显示的页数
private $total_pages; //总页数
private $page_tpl = array (); // 分页模板
private $pageparam;
private $pagelink;
private $static;
function __construct($total_size = 1, $page_size = 20, $current_page = 1, $sub_pages = 6, $pageparam = 'page', $pagelink = '', $static = false) {
$this->page_size = intval ( $page_size );
$this->total_size = intval ( $total_size );
if (! $current_page) {
$this->current_page = 1;
} else {
$this->current_page = intval ( $current_page );
}
$this->total_pages = ceil ( $total_size / $page_size );
$this->sub_pages = intval ( $sub_pages );
$this->pageparam = $pageparam;
$this->pagelink = (empty ( $pagelink ) ? $_server ["php_self"] : $pagelink);
$this->static = $static;
$this->page_tpl ['default'] = array ('tpl' => '<div class="pager">{first}{prev}{liststart}{list}{listend}{next}{last} 跳转到{jump}页</div>', 'config' => array () );
}
public function __set($param, $value) {
$this->$param = $value;
}
public function __get($param) {
return $this->$param;
}
/*
__destruct析构函数,当类不在使用的时候调用,该函数用来释放资源。
*/
function __destruct() {
unset ( $page_size ); //每页显示的条目数
unset ( $total_size ); //总条目数
unset ( $current_page ); //当前被选中的页
unset ( $sub_pages ); //每次显示的页数
unset ( $total_pages ); //总页数
unset ( $page_tpl ); // 分页模板
unset ( $pageparam ); //分页参数,默认page
unset ( $pagelink );
unset ( $static );
}
private function urlparameters($url = array()) {
foreach ( $url as $key => $val ) {
if ($key != $this->pageparam)
$arg [] = $key . '=' . $val;
}
$arg [] = $this->pageparam . '=*';
if ($this->static)
return str_replace ( '{page}', '*', $this->pagelink );
else
return $this->pagelink . '?' . implode ( '&', $arg );
}
public function setpager($tpl_name = 'default', $tpl = '', $config = array()) {
if (empty ( $tpl ))
$tpl = $this->page_tpl ['default'] ['tpl'];
if (empty ( $config ))
$config = $this->page_tpl ['default'] ['config'];
$this->page_tpl [$tpl_name] = array ('tpl' => $tpl, 'config' => $config );
}
public function getpager($tpl_name = 'default') {
$this->getcurrentpage ();
return $this->pager ( $this->page_tpl [$tpl_name] );
}
public function getcurrentpage() {
$this->current_page = ($_get [$this->pageparam] <= intval ( $this->total_pages ) ? ($_get [$this->pageparam] < 1 ? 1 : $_get [$this->pageparam]) : intval ( $this->total_pages ));
}
public function pager($page_tpl = '') {
if (empty ( $page_tpl ))
$page_tpl = $this->page_tpl ['default'];
$cfg = array ('recordcount' => intval ( $this->total_size ), 'pageindex' => intval ( $this->current_page ), 'pagecount' => intval ( $this->total_pages ), 'pagesize' => intval ( $this->page_size ), 'listlong' => intval ( $this->sub_pages ), 'listsidelong' => 2, 'list' => '*', 'currentclass' => 'current', 'link' => $this->urlparameters ( $_get ), 'first' => '«', 'prev' => '‹', 'next' => '›', 'last' => '»', 'more' => '...', 'disabledclass' => 'disabled', 'jump' => 'input', 'jumpplus' => '', 'jumpaction' => '', 'jumplong' => 50 );
if (! empty ( $page_tpl ['config'] )) {
foreach ( $page_tpl ['config'] as $key => $val ) {
if (array_key_exists ( $key, $cfg ))
$cfg [$key] = $val;
}
}
$tmps教程tr = $page_tpl ['tpl'];
$pstart = $cfg ['pageindex'] - (($cfg ['listlong'] / 2) + ($cfg ['listlong'] % 2)) + 1;
$pend = $cfg ['pageindex'] + $cfg ['listlong'] / 2;
if ($pstart < 1) {
$pstart = 1;
$pend = $cfg ['listlong'];
}
if ($pend > $cfg ['pagecount']) {
$pstart = $cfg ['pagecount'] - $cfg ['listlong'] + 1;
$pend = $cfg ['pagecount'];
}
if ($pstart < 1)
$pstart = 1;
for($i = $pstart; $i <= $pend; $i ++) {
if ($i == $cfg ['pageindex'])
$plist .= '<span class="' . $cfg ['currentclass'] . '" >' . str_replace ( '*', $i, $cfg ['list'] ) . '</span> ';
else
$plist .= ' <a href="' . str_replace ( '*', $i, $cfg ['link'] ) . '"> ' . str_replace ( '*', $i, $cfg ['list'] ) . '</a> ';
}
if ($cfg ['listsidelong'] > 0) {
if ($cfg ['listsidelong'] < $pstart) {
for($i = 1; $i <= $cfg ['listsidelong']; $i ++) {
$pliststart .= '<a href="' . str_replace ( '*', $i, $cfg ['link'] ) . '">' . str_replace ( '*', $i, $cfg ['list'] ) . '</a> ';
}
$pliststart .= ($cfg ['listsidelong'] + 1) == $pstart ? '' : $cfg ['more'] . ' ';
} else {
if ($cfg ['listsidelong'] >= $pstart && $pstart > 1) {
for($i = 1; $i <= ($pstart - 1); $i ++) {
$pliststart .= '<a href="' . str_replace ( '*', $i, $cfg ['link'] ) . '">' . str_replace ( '*', $i, $cfg ['list'] ) . '</a> ';
}
}
}
if (($cfg ['pagecount'] - $cfg ['listsidelong']) > $pend) {
$plistend = ' ' . $cfg ['more'] . $plistend;
for($i = (($cfg ['pagecount'] - $cfg ['listsidelong']) + 1); $i <= $cfg ['pagecount']; $i ++) {
$plistend .= ' <a href="' . str_replace ( '*', $i, $cfg ['link'] ) . '"> ' . str_replace ( '*', $i, $cfg ['list'] ) . ' </a> ';
}
} else {
if (($cfg ['pagecount'] - $cfg ['listsidelong']) <= $pend && $pend < $cfg ['pagecount']) {
for($i = ($pend + 1); $i <= $cfg ['pagecount']; $i ++) {
$plistend .= ' <a href="' . str_replace ( '*', $i, $cfg ['link'] ) . '"> ' . str_replace ( '*', $i, $cfg ['list'] ) . ' </a> ';
}
}
}
}
if ($cfg ['pageindex'] > 1) {
$pfirst = ' <a href="' . str_replace ( '*', '1', $cfg ['link'] ) . '">' . $cfg ['first'] . '</a> ';
$pprev = ' <a href="' . str_replace ( '*', $cfg ['pageindex'] - 1, $cfg ['link'] ) . '">' . $cfg ['prev'] . '</a> ';
} else {
$pfirst = ' <span class="' . $cfg ['disabledclass'] . '">' . $cfg ['first'] . '</span> ';
$pprev = ' <span class="' . $cfg ['disabledclass'] . '">' . $cfg ['prev'] . '</span> ';
}
if ($cfg ['pageindex'] < $cfg ['pagecount']) {
$plast = ' <a href="' . str_replace ( '*', $cfg ['pagecount'], $cfg ['link'] ) . '">' . $cfg ['last'] . '</a> ';
$pnext = ' <a href="' . str_replace ( '*', $cfg ['pageindex'] + 1, $cfg ['link'] ) . '">' . $cfg ['next'] . '</a> ';
} else {
$plast = ' <span class="' . $cfg ['disabledclass'] . '">' . $cfg ['last'] . '</span> ';
$pnext = ' <span class="' . $cfg ['disabledclass'] . '">' . $cfg ['next'] . '</span> ';
}
switch (strtolower ( $cfg ['jump'] )) {
case 'input' :
$pjumpvalue = 'this.value';
$pjump = '<input type="text" size="3" title="请输入要跳转到的页数并回车"' . (($cfg ['jumpplus'] == '') ? '' : ' ' . $cfg ['jumpplus']);
$pjump .= ' onkeydown="网页特效:if(event.charcode==13||event.keycode==13){if(!isnan(' . $pjumpvalue . ')){';
$pjump .= ($cfg ['jumpaction'] == '' ? ((strtolower ( substr ( $cfg ['link'], 0, 11 ) ) == 'javascript:') ? str_replace ( '*', $pjumpvalue, substr ( $cfg ['link'], 12 ) ) : " document.location.href='" . str_replace ( '*', ''+' . $pjumpvalue . '+'', $cfg ['link'] ) . '';') : str_replace ( "*", $pjumpvalue, $cfg ['jumpaction'] ));
$pjump .= '}return false;}" />';
break;
case 'select' :
$pjumpvalue = "this.options[this.selectedindex].value";
$pjump = '<select ' . ($cfg ['jumpplus'] == '' ? ' ' . $cfg ['jumpplus'] . ' onchange="javascript:' : $cfg ['jumpplus']);
$pjump .= ($cfg ['jumpaction'] == '' ? ((strtolower ( substr ( $cfg ['link'], 0, 11 ) ) == 'javascript:') ? str_replace ( '*', $pjumpvalue, substr ( $cfg ['link'], 12 ) ) : " document.location.href='" . str_replace ( '*', ''+' . $pjumpvalue . '+'', $cfg ['link'] ) . '';') : str_replace ( "*", $pjumpvalue, $cfg ['jumpaction'] ));
$pjump .= '" title="请选择要跳转到的页数"> ';
if ($cfg ['jumplong'] == 0) {
for($i = 0; $i <= $cfg ['pagecount']; $i ++) {
$pjump .= '<option value="' . $i . '"' . (($i == $cfg ['pageindex']) ? ' selected="selected"' : '') . ' >' . $i . '</option> ';
}
} else {
$pjumplong = intval ( $cfg ['jumplong'] / 2 );
$pjumpstart = ((($cfg ['pageindex'] - $pjumplong) < 1) ? 1 : ($cfg ['pageindex'] - $pjumplong));
$pjumpstart = ((($cfg ['pagecount'] - $cfg ['pageindex']) < $pjumplong) ? ($pjumpstart - ($pjumplong - ($cfg ['pagecount'] - $cfg ['pageindex'])) + 1) : $pjumpstart);
$pjumpstart = (($pjumpstart < 1) ? 1 : $pjumpstart);
$j = 1;
for($i = $pjumpstart; $i <= $cfg ['pageindex']; $i ++, $j ++) {
$pjump .= '<option value="' . $i . '"' . (($i == $cfg ['pageindex']) ? ' selected="selected"' : '') . '>' . $i . '</option> ';
}
$pjumplong = $cfg ['pagecount'] - $cfg ['pageindex'] < $pjumplong ? $pjumplong : $pjumplong + ($pjumplong - $j) + 1;
$pjumpend = $cfg ['pageindex'] + $pjumplong > $cfg ['pagecount'] ? $cfg ['pagecount'] : $cfg ['pageindex'] + $pjumplong;
for($i = $cfg ['pageindex'] + 1; $i <= $pjumpend; $i ++) {
$pjump .= '<option value="' . $i . '">' . $i . '</option> ';
}
}
$pjump .= '</select>';
break;
}
$patterns = array ('/{recordcount}/', '/{pagecount}/', '/{pageindex}/', '/{pagesize}/', '/{list}/', '/{liststart}/', '/{listend}/', '/{first}/', '/{prev}/', '/{next}/', '/{last}/', '/{jump}/' );
$replace = array ($cfg ['recordcount'], $cfg ['pagecount'], $cfg ['pageindex'], $cfg ['pagesize'], $plist, $pliststart, $plistend, $pfirst, $pprev, $pnext, $plast, $pjump );
$tmpstr = chr ( 13 ) . chr ( 10 ) . preg_replace ( $patterns, $replace, $tmpstr ) . chr ( 13 ) . chr ( 10 );
unset ( $cfg );
return $tmpstr;
}
}
?>
本款文件上传类,默认是上传单文件的,我们只要修改$inputname ='files'为你的表单名就可以方便的实现批量文件上传了。 $savename = ''保存文件名, $alowexts = array()设置允许上传的类型,$savepath = ''保存路径。
*/
代码如下 | 复制代码 |
class upload function __construct($inputname ='files', $savepath = '', $savename = '', $alowexts = array(),$maxsize = 1024000) if(!make_dir($this->savepath)) if(move_uploaded_file($tmp_name,$this->savepath.$savename) || @copy($tmp_name,$this->savepath.$savename)) function isuploadedfile($file) //去掉系统自带的反斜线 function error() } |
//使用方法
new upload();
代码如下 | 复制代码 |
*/ $url = strtolower(trim($_get['url'])); $url = getshorturl($url); if (empty($pn)) $pn = 1; switch ($lm) { <body> function文件 <?php 源码下载地址 http://down.111cn.net/s/2010/1025/21415.html |
相关文章
- 最近做了个扫描二维码得到vcard的项目,遇到一个问题,有一部分生成完的二维码,用android系统手机扫描后得到的vcard中的中文姓名是乱码,经过比对发现,这部分vcard中ORG这个...2016-11-25
php 中file_get_contents超时问题的解决方法
file_get_contents超时我知道最多的原因就是你机器访问远程机器过慢,导致php脚本超时了,但也有其它很多原因,下面我来总结file_get_contents超时问题的解决方法总结。...2016-11-25- php如何实现抓取网页图片,相较于手动的粘贴复制,使用小程序要方便快捷多了,喜欢编程的人总会喜欢制作一些简单有用的小软件,最近就参考了网上一个php抓取图片代码,封装了一个php远程抓取图片的类,测试了一下,效果还不错分享...2015-10-30
- 相信很多站长都遇到过这样一个问题,访问页面时出现408错误,下面一聚教程网将为大家介绍408错误出现的原因以及408错误的解决办法。 HTTP 408错误出现原因: HTT...2017-01-22
- 下面我们来看一篇关于Android子控件超出父控件的范围显示出来方法,希望这篇文章能够帮助到各位朋友,有碰到此问题的朋友可以进来看看哦。 <RelativeLayout xmlns:an...2016-10-02
- ps软件是现在非常受大家喜欢的一款软件,有着非常不错的使用功能。这次文章就给大家介绍下ps把文字背景变透明的操作方法,喜欢的一起来看看。 1、使用Photoshop软件...2017-07-06
- 1.在没有设置默认值的情况下: 复制代码 代码如下:SELECT userinfo.id, user_name, role, adm_regionid, region_name , create_timeFROM userinfoLEFT JOIN region ON userinfo.adm_regionid = region.id 结果:...2014-05-31
intellij idea快速查看当前类中的所有方法(推荐)
这篇文章主要介绍了intellij idea快速查看当前类中的所有方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-09-02- 今天在写一个vbs的时候,发现中文乱码,后来写好代码正常运行的代码压缩一下给了同事,发现报无效字符,经过验证后发现原来是编码的问题导致,这里就为大家分享一下...2020-06-30
js导出table数据到excel即导出为EXCEL文档的方法
复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ht...2013-10-13- 批量更新mysql更新语句很简单,更新一条数据的某个字段,一般这样写:复制代码 代码如下:UPDATE mytable SET myfield = 'value' WHERE other_field = 'other_value';如果更新同一字段为同一个值,mysql也很简单,修改下where即...2013-10-04
- ps软件是一款非常不错的图片处理软件,有着非常不错的使用效果。这次文章要给大家介绍的是ps怎么制作倒影,一起来看看设计倒影的方法。 用ps怎么做倒影最终效果̳...2017-07-06
- 本文涉及的主题虽然很基础,在许多人看来属于小伎俩,但在JavaScript基础知识中属于一个综合性的话题。这里会涉及到对象属性的封装、原型、构造函数、闭包以及立即执行表达式等知识。公有方法 公有方法就是能被外部访问...2015-11-08
安卓手机wifi打不开修复教程,安卓手机wifi打不开解决方法
手机wifi打不开?让小编来告诉你如何解决。还不知道的朋友快来看看。 手机wifi是现在生活中最常用的手机功能,但是遇到手机wifi打不开的情况该怎么办呢?如果手机wifi...2016-12-21- 最近想自学PHP ,做了个验证码,但不知道怎么搞的,总出现一个如下图的小红叉,但验证码就是显示不出来,原因如下 未修改之前,出现如下错误; (1)修改步骤如下,原因如下,原因是apache权限没开, (2)点击打开php.int., 搜索extension=ph...2013-10-04
- 单个字符分割 string s="abcdeabcdeabcde"; string[] sArray=s.Split('c'); foreach(string i in sArray) Console.WriteLine(i.ToString()); 输出下面的结果: ab de...2020-06-25
- javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位 方法一: 复制代码 代码如下: document.all["panelsms"].style.visibility="hidden"; document.all["panelsms"].style.visi...2013-10-13
连接MySql速度慢的解决方法(skip-name-resolve)
最近在Linux服务器上安装MySql5后,本地使用客户端连MySql速度超慢,本地程序连接也超慢。 解决方法:在配置文件my.cnf的[mysqld]下加入skip-name-resolve。原因是默认安装的MySql开启了DNS的反向解析。如果禁用的话就不能...2015-10-21- 本篇文章是对C#方法进行了详细的总结与介绍,需要的朋友参考下...2020-06-25
关于Mysql中文乱码问题该如何解决(乱码问题完美解决方案)
最近两天做项目总是被乱码问题困扰着,这不刚把mysql中文乱码问题解决了,下面小编把我的解决方案分享给大家,供大家参考,也方便以后自己查阅。首先:用show variables like “%colla%”;show varables like “%char%”;这两条...2015-11-24