我正在尝试将重置功能添加到 codeigniter 的迁移中。下面是我的代码:
class Migration extends Backend_Controller {
public function __construct()
{
parent::__construct();
$this->load->library('migration');
}
public function index()
{
//...
}
public function reset()
{
$this->migration->version(1);
$this->db->truncate('ci_sessions');
$this->migration->current();
}
}
它返回错误:
Fatal error: Cannot redeclare class Migration_Create_geo_data in D:\web_projects\vProject\framework\application\migrations\002_create_geo_data.php on line 44
如果我单独运行它们,一切都很好。当在一起时,它会产生错误。任何想法?