php文件中的中文乱码该怎么解决

WBOY
Release: 2016-06-13 11:59:26
Original
888 people have browsed it

php文件中的中文乱码该如何解决
下面的文件的注释部分含有部分中文,但是乱码了。各位大神,知道该如何把乱码部分解析成中文吗?
class Database
{
/*****************************************************
** MySQL????????????
*****************************************************/
var $db;
var $seconds;
var $queries;
var $timer      = 0;
var $querytimes = array();
var $duration = '';

public $connectData=true;

/*****************************************************
** ??????,?????????
*****************************************************/
function Database($server = '', $username = '', $password = '', $database = '')
{
global $site_engine_root;
// $this->seconds = $this->currentTime();
if ('' == $server)
{
/*****************************************************
** ????????????????
*****************************************************/
$server   = $GLOBALS['db_host'];
$username = $GLOBALS['db_user'];
$password = $GLOBALS['db_pass'];
$database = $GLOBALS['db_name'];
}
/*****************************************************
** ?????????
*****************************************************/
if (!$this->db = @mysql_pconnect($server, $username, $password))
{
if ($username == 'root' && $database == 'siteengine')
  {
  @header("Location:/install.php");
  }
  else
  {
  $this->connectData=false;
  //$this->error("database connect fail");
  }
}
if ($database&&$this->connectData===true)
{
if($this->version() > '4.1')
{
global $config_charset;
$config_charset = 'utf-8';
if(!$dbcharset && in_array(strtolower($config_charset), array('gbk', 'big5', 'utf-8')))
{
$dbcharset = str_replace('-', '', $config_charset);
}
if($dbcharset)
{
mysql_query("SET NAMES '$dbcharset'");
}
}

if($this->version() > '5.0.1')
{
mysql_query("SET sql_mode=''");
}
$this->selectDb($database);
}
return true;
}

/*****************************************************
** ????????????
*****************************************************/
function disconnect()
{
$result = mysql_close() or $this->error();
return $result;
}

/*****************************************************
** ????????
*****************************************************/
function selectDb($database)
{
global $multidomain,$site_engine_root,$tablepre,$db;
if (@mysql_select_db($database, $this->db))
{
return true;
}
else
{
if ($multidomain==1)
{
$query = $this->query("CREATE DATABASE ".$database);
  @header("Location:/install.php");
                // require $site_engine_root.'lib/query.php';
                // $fp = @fopen($site_engine_root.'data/sql/siteengine.sql', "r");
                // [email protected]($fp, filesize($site_engine_root.'data/sql/siteengine.sql'));
                // @fclose($fp);
                // if($tablepre!='boka') $query=str_replace("boka_",$tablepre,$query);
                // $sql_query = new query($query);
                // $sql_query->doquery();
  // @header("Location:/index.php");

}
  $this->error("$database database connect error!");
}
}

/*****************************************************
** ???????????Web?????????У????????????????С???Web?????·???true???????????·???false
*****************************************************/
function isWebEnv()
{
if (isset($_SERVER['PHP_SELF']))
{
return true;
}
if (isset($GLOBALS['_SERVER']['PHP_SELF']))
{
return true;
}
return false;
}
/*****************************************************
** ???????????????????
*****************************************************/
function _textConvert($text)
{
if ($this->isWebEnv())              // Web????
{
return nl2br($text);
}
return $text;
}

/*****************************************************
** ?????????
*****************************************************/

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!