$content = Iconv ("GBK", "Utf-8", $content);//First easy to use
$content = mb_convert_encoding ($content, "Utf-8", "GBK");//The second avoids surprises
copy code //discovers that ICONV will fail when converting the character "-" to
Copy CodeCan solve the problem of Chinese garbled, of course, can also modify charset=utf-8 for charset=gb2312, according to their own page encoding. PHP MySQL table Chinese garbled problem how to solve PHP import CSV file Chinese garbled solution
/**
* Function: Query all categories to generate tree menu
* @param int $pid Parent ID start Query from top level by default
*/
function Totree ($pid =0) {
Query all top-level categories
Database connections There's not
/**
* Full probability calculation
*
* @param array $p Array (' A ' =>0.5, ' B ' =>0.2, ' C ' =>0.4)
* @return String returns the key of the above array
*/
function Random ($ps) {
Static $arr = Array (
*exif_imagetype--Judging the type of an image
* Description: Function function is to cut an image into an image of any size, the image is not deformed
* Parameter Description: Enter the file name that needs to process the picture, generate
In Conf/php.ini, in vim with "/php_mysql" search to Extension=php_mysql.dll, remove the front ";", while the following increase Extension=php_mysqli.dll;
$mysqli = new Mysqli ("127.0.0.1", "username", "password", "library name");
$query = "
/*
* Common coding problems
*
* 1. The page garbled problem:
* Page garbled problem is mainly in the display font encoding and the browser display in the code is inconsistent, the browser output
* The encoding is made by the
Copy Code3, PHP or HTML file itself encoding: with EditPlus open PHP file or HTML file, save, select the encoding, if the database and page encoding is GBK, then the code here choose ANSI; If the database and page encoding is Utf-8, then Utf-8 is
/*
* To change the template for this generated file go to
* Window-preferences-phpeclipse-php-code Templates
*/
Class student{
Property
Private $no;
Private $name;
Private $gender;
Private $age;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service