我在每个问题中搜索了一个答案,但没有找到!
这是我输入localhost / cakephp时的错误:
Notice (8): Undefined index: datasource [CORE\Cake\Model\ConnectionManager.php, line 258]
另一个错误:
Cake is NOT able to connect to the database.
找不到数据源类.
这是我在database.php中的配置:
<?php
class DATABASE_CONFIG {
var $default = array('driver' => 'mysql',
'persistent' => false,
'database' => '',
'host' => 'localhost',
'login' => 'lorizz',
'password' => 'reyxD22!',
'database' => 'my_cakephp_project',
'prefix' => '');
var $test = array('driver' => 'mysql',
'persistent' => false,
'database' => '',
'host' => 'localhost',
'login' => 'lorizz',
'password' => 'reyxD22!',
'database' => 'my_cakephp_project',
'prefix' => '');
}
?>
有答案吗?
最佳答案 在那里,您需要删除变量中使用两次的数据库
var $default和var $test
database.php中的配置应该是:
<?php
class DATABASE_CONFIG {
var $default = array('driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'lorizz',
'password' => 'reyxD22!',
'database' => 'my_cakephp_project',
'prefix' => '');
var $test = array('driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password!',
'database' => 'test_database_name',
'prefix' => '');
}
?>