实际上我正在尝试将我的codeigniter实时文件配置为localhost。
我有,
base_url
,如$config['base_url']=http://localhost/gu_ci/'
;和$config['index_page']='index.php';
在config.php 然后对database.php进行了更改,其中包含
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = ' ';
$db['default']['database'] = 'test_bs';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = TRUE;
$db['default']['cachedir'] = 'application/cache/';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
我的.htacess文件有:
RewriteEngine On
RewriteBase /new_admin/
RewriteCond %{REQUEST_URI} PIE.htc
AddType text/x-component .htc
RewriteRule (.*) static/PIE.htc [L]
RewriteCond %{REQUEST_URI} !^/new_admin/static/
RewriteRule (.*)$ index.php [L]
我收到以下错误:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\gunify_ci\system\database\DB_driver.php
Line Number: 124
我已提及Refer1,Refer2,Refer3,Refer4,Refer5等等...最后一个链接只显示欢迎消息: 但是解决方案都没有帮助我!!
指导我解决这个问题!!
答案 0 :(得分:4)
$db['default']['password'] = '';
有空格,将其删除
使用以下设置
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'test_bs';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
修改01
使用此.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
编辑02
你的文件夹结构应该是
所以代码将是:
<link href="<?php echo base_url(); ?>assets/css/bootstrap.css" rel="stylesheet" />