gpt4 book ai didi

PHP Codeigniter : set Port Number for MySQL Configuration

转载 作者:IT老高 更新时间:2023-10-29 00:19:39 26 4
gpt4 key购买 nike

你能给我解释一下如何为数据库配置设置端口号吗:

class MY_Model extends CI_Model 
{
protected static $db2_loaded = false;
protected static $db2 = false;
function __construct()
{
parent::__construct();
if(($this->session->userdata('login_user')!=false) && !self::$db2_loaded)
{
self::$db2_loaded = true;
$config['hostname'] = "localhost";
$config['username'] = "root";
$config['password'] = "";
$config['database'] = $this->session->userdata('bdd_compte');
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = TRUE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";

$config['dbcollat'] = "utf8_general_ci";
self::$db2 = $this->load->database($config,TRUE);

}
$this->db = self::$db2;


}
}

任何想法我应该如何设置不同的端口号

谢谢!

最佳答案

使用 database.php 中的 port 键。

$db['default']['port'] = 5432;

$db['default']['hostname'] = "mysqlhost.yourdomain.com:3310";  

关于PHP Codeigniter : set Port Number for MySQL Configuration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26716179/

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