Codeigniter使用HMVC(一)
涉及三方代码:
https://tutorials.kode-blog.com/codeigniter-admin-panel
https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc
CodeIgniter3.1.4+php5.6.27+apache2
1、使用框架codeigniter3.1.4
按照上述两个文章的描述,一步一步使用hmvc后,ci3.1.3起会报这个错
Call to undefined method MY_Loader::_ci_object_to_array()
解决方法:I confirm it works by replacing _ci_object_to_array with _ci_prepare_view_vars, with CI 3.1.4
third_party文件夹下的Loader.php文件中,用_ci_prepare_view_vars替换_ci_object_to_array即可
2、给出的.htaccess文件也有问题,不改会一直报No input file specified.
RewriteEngine on RewriteCond $1 !^(index\.php|resources|assets|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
需要更改htaccess文件最后一行为,多加了个问号
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
这样再次运行可以了
-------------------------------------------------
保持专注,只做一件事,做好这件事!@
-------------------------------------------------