【发布时间】:2020-06-23 08:41:09
【问题描述】:
我正在开发一个 PHP API 和一个 CodeIgniter 网站,我需要向数据库(MYSQL)发布/获取一个表单,我为 Android 编写了直接 API,不使用任何框架但工作正常。
PHP API POST 请求代码:
$postDescription = strip_tags($_REQUEST['postDescription']);
$stmtl = $user->runQuery("INSERT INTO posts(postID,userID,postDescription) VALUES('','".$userID."','".$postDescription."')");
网站的 CodeIgniter 代码:
$data = array('postDescription' => $this->input->post('postDescription'),);
return $this->db->insert('posts', $data);
问题是本地语言的帖子数据内容可以很好地插入和获取数据库,但是在从codeigniter网站发布时会像这样的内容????????或显示来自 android 发布内容的数据,如 °¤à°¾à°¡à±‡à°ªà°²à±à°²à°¿ à°•à±à°¯à°¾à°‚à°ªà
我需要在安卓和网站之间发布/显示母语内容。
【问题讨论】:
-
这个标题你试过了吗('Content-type: text/html; charset=utf-8');
-
确保你的表的联盟是utf8mb4
-
尝试了这两个选项!发布的数据只能对那些(android,web)可见
标签: php mysql codeigniter user-input utf