我有一個問題,存儲在mysql文本字段中的json,事情是,一切都OK,直到我使用'(單引號)json然後保存\',每次我將它保存回來追加一個斜槓,如:\ '\\' \\」等從MySQL的JSON打破
則有些字符編碼不正確\ u00e0
<div class="wpbs-calendar-legend" data-info="{"default":{"name":{"default":"Available","hr":"Slobodno","cs":"Volno","da":"Ledigt","nl":"Vrij","en":"Available","fr":"Libre","de":"Frei","hu":"Szabad","it":"Libero","ro":"Disponobil","ru":"\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e","sk":"Vo\u013en\u00fd","es":"Libre","sv":"Ledigt","uk":"B\u0456\u043b\u044c\u043d\u043e","no":""},"color":"#f1ffcc","splitColor":false,"bookable":"yes","auto-pending":"no","sync":"no"},"1":{"name":{"default":"Booked","hr":"Zauzeto","cs":"Obsazeno","da":"Booket","nl":"Bezet","en":"Booked","fr":"Occup\u00e9","de":"Belegt","hu":"Foglalt","it":"Prenotato","ro":"Rezervat","ru":"\u0417\u0430\u043d\u044f\u0442\u043e","sk":"Obsaden\u00fd","es":"Reservado","sv":"Bokat","uk":"\u0417\u0430\u0439\u043d\u044f\u0442\u043e","no":""},"color":"#ff524c","splitColor":false,"bookable":false,"auto-pending":"yes","sync":"yes"},"2":{"name":{"en":">14H","nl":"","et":"","fi":"","fr":"D\u00e8s 14H","de":"","pt":"","ro":"","default":"D\u00e8s 14H"},"color":"#f1ffcc","splitColor":"#ff524c","bookable":"yes","hide":false,"auto-pending":"no","sync":"no"},"3":{"name":{"en":"<12H","nl":"","et":"","fi":"","fr":"Jusqu\\" \u00e0="" 10h","de":"","pt":"","ro":"","default":"jusqu\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\u00e0="" 10h"},"color":"#ff524c","splitcolor":"#f1ffcc","bookable":"yes","hide":false,"auto-pending":"no","sync":"no"}}'=""></div>
,在我insepct窗口如下所示:
我使用的是WordPress,所以這個json_encoded字符串使用update_option保存到數據庫中。我試過對strip_heshes()在update_option上的json編碼字符串,但沒有解決問題。
有人可以幫助我嗎?
感謝您的時間!
的數據信息是htmlentity編碼。 – Daniel