贴心
全国7×24小时客服热线
安全
病毒杀除率高于99%
稳定
网站可用性高于99.9%
实力
服务68家上市企业及集团公司
点击数:12732015-07-14 10:42:01 来源: 外贸网站建设,深圳外贸网站建设,深圳网站建设,外贸商城网站制作-亿恩科技
在使用PHPMYAdmin的时候,常用的字符集一般有GBK,GB2312或UTF8 可以在修改或添加字符编码的时候,那字符集也太多了,如何才能只显示我们常用的字符集,让那些不常用的隐藏,或去掉那些不常用的字符集,让修改字段看起来 更清爽,现提供一种解决方法.
首先说明一下我使用的PHPMyAdmin版本 3.5.2.2
找到:\libraries\mysql_charsets.lib.php
找到:function PMA_generateCharsetDropdownBox() 函数
在:foreach ($mysql_charsets as $current_charset) { 循环后加一句:
- if(!in_array($current_charset,array('gb2312','gbk','utf8'))){
- continue;
- }
找到:foreach ($mysql_collations[$current_charset] as $current_collation) { 循环,在其后加一句:
- if(!in_array($current_collation,array('gb2312_bin','gb2312_chinese_ci','gbk_bin','gbk_chinese_ci','utf8_general_ci')))
- {
- continue;
- }
现贴出PMA_generateCharsetDropdownBox 的完整函数:
- function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION,
- $name = null, $id = null, $default = null, $label = true, $indent = 0,
- $submitOnChange = false, $displayUnavailable = false)
- {
- global $mysql_charsets, $mysql_charsets_descriptions,
- $mysql_charsets_available, $mysql_collations, $mysql_collations_available;
- if (emptyempty($name)) {
- if ($type == PMA_CSDROPDOWN_COLLATION) {
- $name = 'collation';
- } else {
- $name = 'character_set';
- }
- }
- $return_str = '<select xml:lang="en" dir="ltr" name="'
- . htmlspecialchars($name) . '"'
- . (emptyempty($id) ? '' : ' id="' . htmlspecialchars($id) . '"')
- . ($submitOnChange ? ' class="autosubmit"' : '') . '>' . "\n";
- if ($label) {
- $return_str .= '<option value="">'
- . ($type == PMA_CSDROPDOWN_COLLATION ? __('Collation') : __('Charset'))
- . '</option>' . "\n";
- }
- $return_str .= '<option value=""></option>' . "\n";
- foreach ($mysql_charsets as $current_charset) {
- if(!in_array($current_charset,array('gb2312','gbk','utf8'))){
- continue;
- }
- if (!$mysql_charsets_available[$current_charset]) {
- continue; //vcphp.com
- }
- $current_cs_descr
- = emptyempty($mysql_charsets_descriptions[$current_charset])
- ? $current_charset
- : $mysql_charsets_descriptions[$current_charset];
- if ($type == PMA_CSDROPDOWN_COLLATION) {
- $return_str .= '<optgroup label="' . $current_charset
- . '" title="' . $current_cs_descr . '">' . "\n";
- foreach ($mysql_collations[$current_charset] as $current_collation) {
- if(!in_array($current_collation,array('gb2312_bin','gb2312_chinese_ci','gbk_bin','gbk_chinese_ci','utf8_general_ci')))
- {
- continue;
- }
- if (!$mysql_collations_available[$current_collation]) {
- continue;
- }
- $return_str .= '<option value="' . $current_collation
- . '" title="' . PMA_getCollationDescr($current_collation) . '"'
- . ($default == $current_collation ? ' selected="selected"' : '') . '>'
- . $current_collation . '</option>' . "\n";
- }
- $return_str .= '</optgroup>' . "\n";
- } else {
- $return_str .= '<option value="' . $current_charset
- . '" title="' . $current_cs_descr . '"'
- . ($default == $current_charset ? ' selected="selected"' : '') . '>'
- . $current_charset . '</option>' . "\n";
- }
- }