嗨,我正在尝试使用表单将阿拉伯语数据提交到 mysql我已经坐上了所有应该用阿拉伯语的表格列来u8_general_ci当我通过phpmyadmin保存数据时,它保存得很好,检索得很好,但是当我通过表单提交数据时,数据保存为问号"?????"虽然我用了所有论文
<form action="" method="post" accept-charset="utf-8" >
header("Content-Type: text/html;charset=UTF-8");
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
解决方案是什么,提前感谢:)
确保设置连接字符集,运行以下命令:
//PDO example
$dbh->exec('SET CHARACTER SET utf8');
使用 HTML5 模式属性。
将这个用于阿拉伯语:pattern=[أ-يa-zA-Z]
例:
<input type="text" name="fname" pattern=[أ-يa-zA-Z] placeholder="Type your name">