<legend id='IhpLv'><style id='IhpLv'><dir id='IhpLv'><q id='IhpLv'></q></dir></style></legend>
    1. <i id='IhpLv'><tr id='IhpLv'><dt id='IhpLv'><q id='IhpLv'><span id='IhpLv'><b id='IhpLv'><form id='IhpLv'><ins id='IhpLv'></ins><ul id='IhpLv'></ul><sub id='IhpLv'></sub></form><legend id='IhpLv'></legend><bdo id='IhpLv'><pre id='IhpLv'><center id='IhpLv'></center></pre></bdo></b><th id='IhpLv'></th></span></q></dt></tr></i><div id='IhpLv'><tfoot id='IhpLv'></tfoot><dl id='IhpLv'><fieldset id='IhpLv'></fieldset></dl></div>
        <bdo id='IhpLv'></bdo><ul id='IhpLv'></ul>
      1. <tfoot id='IhpLv'></tfoot>
      2. <small id='IhpLv'></small><noframes id='IhpLv'>

        使用php将阿拉伯语文本存储在mysql数据库中

        时间:2023-07-29

        <small id='pPEkj'></small><noframes id='pPEkj'>

      3. <i id='pPEkj'><tr id='pPEkj'><dt id='pPEkj'><q id='pPEkj'><span id='pPEkj'><b id='pPEkj'><form id='pPEkj'><ins id='pPEkj'></ins><ul id='pPEkj'></ul><sub id='pPEkj'></sub></form><legend id='pPEkj'></legend><bdo id='pPEkj'><pre id='pPEkj'><center id='pPEkj'></center></pre></bdo></b><th id='pPEkj'></th></span></q></dt></tr></i><div id='pPEkj'><tfoot id='pPEkj'></tfoot><dl id='pPEkj'><fieldset id='pPEkj'></fieldset></dl></div>

              <legend id='pPEkj'><style id='pPEkj'><dir id='pPEkj'><q id='pPEkj'></q></dir></style></legend>
                <bdo id='pPEkj'></bdo><ul id='pPEkj'></ul>

                  <tbody id='pPEkj'></tbody>
                1. <tfoot id='pPEkj'></tfoot>

                2. 本文介绍了使用php将阿拉伯语文本存储在mysql数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在 mysql 数据库中存储一些阿拉伯语数据我已将 html 文档字符集设置为 'utf8'

                  I am trying to store some Arabic data in a mysql database I have set the html document charset to be 'utf8'

                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
                  

                  MySQL 字符集设置为:UTF-8 Unicode (utf8)

                  MySQL charset is set to: UTF-8 Unicode (utf8)

                  MySQL 连接排序规则设置为:utf8_general_ci

                  MySQL connection collation is set to: utf8_general_ci

                  数据库和表的排序规则设置为:utf8_general_ci

                  Database and table collations are set to: utf8_general_ci

                  此外,在我的 php 代码中,我使用了 $mysqli->set_charset("utf8") 函数来确保字符集设置为 ut8 但实际上没有任何工作,我正在发布我的数据使用 html 形式的 php 脚本,其中 enctype 是:enctype="multipart/form-data" 因为在这种形式中我还上传了一个图像

                  In addition in my php code I used the $mysqli->set_charset("utf8") function to ensure that the charset is set to be ut8 but nothing is actually working , I am posting my data to the php script using html form where the enctype is : enctype="multipart/form-data" because in this form I also upload an image

                  奇怪的是,当我直接在 mysql 中编写查询时,阿拉伯字符存储正确没有问题,但是当我使用 php 查询存储数据时,所有字符都存储在错误的字符集编码中

                  The weird thing is that when I write my query directly in mysql the Arabic characters are stored properly with no problem , but when I use a php query to store the data all the characters are stored in a wrong charset encoding

                  有什么建议吗?

                  推荐答案

                  奇怪,它应该管用!

                  在成功连接到数据库后尝试添加这些行:

                  Try adding these lines after a successful connection to the database:

                  $mysqli->query("SET NAMES 'utf8'");
                  $mysqli->query("SET CHARACTER SET utf8");
                  


                  例如:

                  $mysqli = @new mysqli('DB_HOST', 'DB_USER', 'DB_PASS', 'DB_NAME');
                  
                  if($mysqli->connect_errno) die('Connection Error!');
                  else{
                      $mysqli->query("SET NAMES 'utf8'");
                      $mysqli->query("SET CHARACTER SET utf8");
                  }
                  


                  并在您的 php 页面的 head 部分包含这些 META 标签:


                  And include these META tags in the head section of your php page:

                  <meta charset="utf-8">
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                  

                  这篇关于使用php将阿拉伯语文本存储在mysql数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP 中动态 mysqli bind_param 参数的简单解决方案是什 下一篇:mysqli_query() 总是返回真

                  相关文章

                  最新文章

                  <i id='4somO'><tr id='4somO'><dt id='4somO'><q id='4somO'><span id='4somO'><b id='4somO'><form id='4somO'><ins id='4somO'></ins><ul id='4somO'></ul><sub id='4somO'></sub></form><legend id='4somO'></legend><bdo id='4somO'><pre id='4somO'><center id='4somO'></center></pre></bdo></b><th id='4somO'></th></span></q></dt></tr></i><div id='4somO'><tfoot id='4somO'></tfoot><dl id='4somO'><fieldset id='4somO'></fieldset></dl></div>
                3. <small id='4somO'></small><noframes id='4somO'>

                  <legend id='4somO'><style id='4somO'><dir id='4somO'><q id='4somO'></q></dir></style></legend>

                      • <bdo id='4somO'></bdo><ul id='4somO'></ul>
                    1. <tfoot id='4somO'></tfoot>