Heim > Artikel > Backend-Entwicklung > 项目从Codeigniter 2.2升级至 Codeigniter 3.0的一些注意事项,codeigniter2.2_PHP教程
1. 替换掉system目录下所有的文件和文件夹,以及替换掉index.php
2. controllers和models中的文件首字母都需要改成大写:application.php -> Application.php, m_application.php -> M_application.php
3. 替换掉config/mimes.php
4. 把$auto_load['core']从config/autoload.php里移除
5. session库的使用有了较大改变:项目里主要就是修改了unset_user_data函数
<span>//</span><span> Old</span> <span>$this</span>->session->unset_userdata(<span>array</span>('item' => '', 'item2' => ''<span>)); </span><span>//</span><span> New</span> <span>$this</span>->session->unset_userdata(<span>array</span>('item', 'item2'));
6. 更新config/database.php文件
<span>$active_group</span> = 'default'<span>; </span><span>//</span><span> $active_record = TRUE;</span> <span>$query_builder</span> = <span>TRUE</span><span>; </span><span>//</span><span>$db['default']['dbdriver'] = 'mysql';</span> <span>$db</span>['default']['dbdriver'] = 'mysqli';
7. 把CI3.0 views文件夹下的errors文件夹复制到项目的views文件夹下
8. 更新config/routes.php文件,CI3.0中(:any)不包括'/'
(.+) <span>//</span><span> matches ANYTHING</span> (:any) <span>//</span><span> matches any character, except for '/'</span>
更多信息请查看:http://codeigniter.org.cn/user_guide/installation/upgrade_300.html