<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
mysql_connect("172.16.2.6","root","root");
mysql_select_db("*****");
mysql_query("set names utf8");
$check_query = mysql_query("select * from test");
$i=0;
$row=mysql_fetch_assoc($check_query);
do{
$rows[$i]=$row;
$i++;
}
while ($row=mysql_fetch_assoc($check_query));
print_r($rows);
/* while ($row=mysql_fetch_array($check_query));
print_r($rows);
for($i=0;$i<count($rows);$i++){
echo "<hr>";
for($j=0;$j<=2;$j++){
echo $rows[$i][$j]."  ";
}
echo "<br>";
}
*/
echo "<br>";echo "<br>";echo "<br>";echo "<br>";
$code = json_encode($rows);
echo $code = preg_replace("#\\\u([0-9a-f]+)#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", $code);
echo "<br>";echo "<br>";echo "<br>";echo "<br>";
var_dump($rows);
?>
|
|