gpt4 book ai didi

php - ????使用 CodeIgniter 在 mysql 上处理希腊字符

转载 作者:行者123 更新时间:2023-11-30 01:11:00 25 4
gpt4 key购买 nike

我将数据库设置设置为

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 ,我是否还要在模块上做其他事情?

最佳答案

您可以检查给定的更改。请将排序规则更改为utf8_unicode_ci。也许它对你有用。

关于php - ????使用 CodeIgniter 在 mysql 上处理希腊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19473552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com