Ms7 Search
Google 搜尋 翻譯
calendar
« 九月 2024 »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
近期文章
文章分類
網站連結
Syndicate

« | »

mysql 插入數據時出現 Incorrect string value: '\xF0\x9F...' for column 'name' at row 1的異常

2020-08-12 @ 17:31 in PHP, JavaScript, Sql

最近在用 Excel 檔匯入資料時,顯示 Error , 轉成 Csv 再匯入就正常, 查網,原來是有些 Utf8 圖型或造字用到 4碼(含)以上,而 Mysql 的 Utf8 內定3碼,解決方法網上是將內定 Utf8 3碼改成 character-set-server=utf8mb4 4碼,資料表也要更改(https://blog.csdn.net/m0_37983376/article/details/79224862)有修改方法,可是我改後無效,不知少了什麼,後來想,那些造字沒有顯示對網頁來說沒有那麼重要,所以想到一個取巧的方式,將這些字丟掉不存在就可以了,方法是,在 php 程式,將 utf8 轉成 big5 ,那些字就會用 "?" 代替,再將它轉回 Utf8 給網頁用,再樣那些字就給轉不見了, Csv 不用轉,因為它本來就是 big5,程式自動轉成 Utf8 ,指令如下:

if($type != "csv")            //不是csv檔,$str 轉big5再轉回Utf-8,排除 utf8 4碼以上字及造字,mysql utf8 內定三碼 
      {
       $str5 = mb_convert_encoding($str, "big5" , "UTF-8");
       $str = mb_convert_encoding($str5, "UTF-8", "big5");
       }

迴響

mysql 插入數據時出現 Incorrect string value: \xF0\x9F... for column name at row 1的異常 | 豬窩

yyou are truoy a jyst right webmaster. The wweb sitee loadig pace
iis incredible. It kin of feels that you arre doong aany distinctive trick.
Moreover, The contents are masterwork. yoou have performed a
wonderfl joob inn tis topic!

作者 sexbombo.com/vid/xporn115225313 @ 11:28, 2024-08-30

mysql 插入數據時出現 Incorrect string value: \xF0\x9F... for column name at row 1的異常 | 豬窩

I blopg quite often annd I genuinely thank you for your information. Thee articl has trulky peaked my interest.
I will bookmark yoyr log andd kee checkng for new details bout
nce a week. I opoted iin forr your Feed too.

作者 sitemap.xml @ 19:38, 2024-08-30

mysql 插入數據時出現 Incorrect string value: \xF0\x9F... for column name at row 1的異常 | 豬窩

Hello! I ould hav sorn I've been to tyis blog before but aftfer reading throughh some oof the post I
realied it's nnew to me. Anyhow, I'mdefinitely happy I found iit
and I'll bee book-marking aand checfking bqck frequently!

作者 hornyxxx.win/hornyvid2t2iq15 @ 20:11, 2024-08-30

mysql 插入數據時出現 Incorrect string value: \xF0\x9F... for column name at row 1的異常 | 豬窩

Hello! I coujld have ssworn I've been to thiks siote before but after looking at skme oof tthe posrs I realized it's neew to me.
Nonetheless, I'm certaihly delighted I discovered itt aand I'll bbe book-marking it aand
checxking bac regularly!

作者 xxxweb.info/video/sexoclip428666813 @ 04:22, 2024-08-31

mysql 插入數據時出現 Incorrect string value: \xF0\x9F... for column name at row 1的異常 | 豬窩

Hi, this weekernd is gkod designed for me, since this point in time i am reading tthis
impressive educational paragraph herte at myy residence.

作者 hornyxxx.win/hornyvid6799511911 @ 17:35, 2024-09-01
發表迴響
 authimage