 |
json_encode กับภาษาไทยครับ ปัญหาต้องส่งข้อมูลลงฐาน ให้ java อ่านอีกที |
|
 |
|
|
 |
 |
|
Code (PHP)
$x = '{"test":"test","asdad":"asdad","sdfsd":"ไม้เท้า"}';
$y=urldecode( $x );
$rs = json_decode( $y);
print_r($rs);
|
 |
 |
 |
 |
Date :
2015-04-13 18:14:50 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าจะต้องเอาลงฐานข้อมูลเป็นภาษาไทยเลยอะครับ พอดีต้องใช้ java เป็นตัวดูดออกมาอะครับ
|
 |
 |
 |
 |
Date :
2015-04-17 02:29:55 |
By :
sakang |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$db=new mysqli('localhost','test','test','test');
$x = '{"test":"test","asdad":"asdad","sdfsd":"ไม้เท้า"}';
$y=$db->real_escape_string(html_entity_decode($x, ENT_QUOTES, "utf-8") );
$db->query("update test set json_text='$y' where id=1");

|
 |
 |
 |
 |
Date :
2015-04-17 08:27:49 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|