相关疑难解决方法(0)

$ _POST在utf-8字符上为空

我正在使用CodeIgniter开发一个多语言网站.有一个表单将数据发布到控制器,但是$_POST当我开始使用土耳其字符öçüÜ?等时它是空的.

我将charset设置为:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Run Code Online (Sandbox Code Playgroud)

形成:

<form action="translations/save" method="post" accept-charset="utf-8">
    <textarea rows="6" cols="60" id="editor_tr" name="editor_tr">Türkçe</textarea>
</form>
Run Code Online (Sandbox Code Playgroud)

$_POST$this->input->post('editor_tr')返回空,但我可以看到原始帖子file_get_contents("php://input").

这个在普通的PHP测试中正常工作,但不适用于CodeIgniter.也许我的.htaccess文件导致了这个问题,但不知道.

任何帮助深表感谢.

更新:这是var_dump的请求输出.

var_dump($_POST) - 没有土耳其字符

array(3) { ["id"]=> string(12) "news8titleID" ["editor_tr"]=> string(13) "turkish value" ["editor_en"]=> string(13) "english value" }
Run Code Online (Sandbox Code Playgroud)

var_dump($_POST)- 使用土耳其字符(输入为:Türkçe karakter,但它没有显示在$ _POST中)

array(3) { ["id"]=> string(12) "news8titleID" ["editor_tr"]=> string(0) "" ["editor_en"]=> string(13) "english value" }
Run Code Online (Sandbox Code Playgroud)

更新2: 调试时,我发现system.core.Input该类清除了_clean_input_data函数的输入数据.

// Clean UTF-8 if supported …
Run Code Online (Sandbox Code Playgroud)

php codeigniter character-encoding

8
推荐指数
2
解决办法
7138
查看次数

标签 统计

character-encoding ×1

codeigniter ×1

php ×1