[英]????? on greek characters on mysql using CodeIgniter
我將數據庫設置設置為
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_general_ci
這是我在數據庫中插入記錄的模塊
<?php
class userscoresmodule extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();//Φορτώνει την βάση δεδομένων
}
function AddUserScore($userID,$userName,$score,$userLastname){
$data=array('userID' => $userID,
'userName' => $userName,
'userLastname' => $userLastname,
'score' => $score);
$this->db->insert('highscores', $data);
}
public function getAllScores(){ //Επιστρέφει τα προϊόντα
$this->db->select('*');
$this->db->from('highscores');
$this->db->limit(10);
$this->db->order_by("score", "desc");
$query = $this->db->get();
//$query = $this->db->get('highscores');
return $query->result_array(); // Επιστρέφει το αποτέλεσμα με την μορφή array
}
}
?>
問題是,當它在數據庫中添加帶有希臘字符的記錄時,就像????????
。 我讀過一些文章,我必須在UTF-8上設置數據庫,我是否還要在模塊上做其他事情?
您可以通過給定的更改進行檢查。 請將Collation更改為utf8_unicode_ci 。 也許它將為您工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.