有没有办法使用 php 版本 7.2 在 codeigniter 3 和 sql server

我可以使用什么方法在 codeigniter 和 sql server 之间创建连接?以下是我的连接方式,但似乎不起作用


    $active_group = 'default'; $query_builder = TRUE; $db['default'] = array(

'dsn'   => '',

'hostname' => 'localhost',

'port' => '1433',

'username' => 'username',

'password' => '*****',

'database' => 'database_name',

'dbdriver' => 'mssql',

'dbprefix' => '',

'pconnect' => FALSE,

// 'db_debug' => (ENVIRONMENT !== 'production'),

'cache_on' => FALSE,

'cachedir' => '',

'char_set' => 'utf8',

'dbcollat' => 'utf8_general_ci',

'swap_pre' => '',

'encrypt' => FALSE,

'compress' => FALSE,

'stricton' => FALSE,

'failover' => array(),

'save_queries' => TRUE

);


连接未建立,我不知道问题出在哪里


皈依舞
浏览 97回答 1
1回答

开心每一天1111

$active_group = 'default'; $query_builder = TRUE; $db['default'] = array('dsn'   => '','hostname' => 'computer_name\SQLEXPRESS','port' => '1433','username' => 'username','password' => '*****','database' => 'database_name','dbdriver' => 'sqlsrv','dbprefix' => '','pconnect' => FALSE,'db_debug' => (ENVIRONMENT !== 'production'),'cache_on' => FALSE,'cachedir' => '','char_set' => 'utf8','dbcollat' => 'utf8_general_ci','swap_pre' => '','encrypt' => FALSE,'compress' => FALSE,'stricton' => FALSE,'failover' => array(),'save_queries' => TRUE);首先,我需要在我的计算机上安装 sql server php 驱动程序来安装扩展。下载驱动程序然后解压,然后将 php_pdo_sqlsrv_72_nts_x64.dll、php_pdo_sqlsrv_72_ts_x64.dll、php_sqlsrv_72_nts_x64.dll、php_sqlsrv_72_ts_x64.dll 复制到 /php/ext。然后将它们添加extension=php_pdo_sqlsrv_72_nts_x64.dll extension=php_pdo_sqlsrv_72_ts_x64.dll extension=php_sqlsrv_72_nts_x64.dll extension=php_sqlsrv_72_ts_x64.dll到/php/php.ini中。重新启动阿帕奇
打开App,查看更多内容
随时随地看视频慕课网APP