草庐IT

codeigniter-hmvc

全部标签

php - Codeigniter htaccess 删除 index.php 和 www

我试图让我的htaccess重写规则从url中删除index.php并将www.请求重定向到非www版本。这是我的htaccess,可以很好地删除index.php:RewriteEngineonRewriteCond$1!^(index\.php|resources|robots\.txt)RewriteCond%{REQUEST_FILENAME}!-fRewriteCond%{REQUEST_FILENAME}!-dRewriteRule^(.*)$index.php/$1[L,QSA]我遇到了另一个关于如何删除www部分的问题:RewriteEngineOnRewriteCon

php - Codeigniter 扩展 native 库

我在codeigniter中扩展native库时遇到问题。Controller:functionsearch(){$query_array=array('title'=>$this->input->post('title'),'category'=>$this->input->post('category'));$query_id=$this->input->save_query($query_array);//extendstosave_queryredirect("site/view_games/$query_id");}扩展库:db->insert('e_queries',arr

php - codeigniter 展平查询结果数组

这个问题在这里已经有了答案:Isthereafunctiontoextracta'column'fromanarrayinPHP?(15个答案)关闭5个月前。我在Codeigniter中使用查询返回属于用户的所有行的ID。$this->db->select('id');$this->db->where('user_id',99);$query=$this->db->get('my_table');return$query->result_array();返回Array([0]=>Array([id]=>8)[1]=>Array([id]=>7)[2]=>Array([id]=>6))是

php - codeigniter 中的未定义索引错误

只是为了一些背景,我使用带有模板Spark的codeigniter。所以在我的Controller中我有以下功能publicfunctioninformation(){$this->load->library('session');$developer_id=$this->session->userdata('developer_id');$this->load->model("Developer_model");$information=$this->Developer_model->get_developer($developer_id);$this->template->set(

php - 如何在codeigniter中修改路由

帮我解决这个问题。举个例子:我有这个正常的网址“localhost/CI/index.php/base/storeurl”。如何让Codeigniter知道要查找“本地主机/CI/storeurl”。我有一个名为index的函数,它在Base.php类中接受一个参数storeURL。帮我解决这个问题。提前致谢。 最佳答案 我终于找到了我要找的东西。这是我的代码在routes.php中的样子。/*CustomRoutes.*///StoreNormalPages.$route['home/(:any)']="base/home/$1"

php - PasswordHash 不适用于 CodeIgniter

我已经把我从http://www.openwall.com/phpass/下载的文件放了到application/libraries在我的Controller中,我正在使用这段代码-$params=array('phpass_hash_strength'=>8,'phpass_hash_portable'=>FALSE);$this->load->library('PasswordHash',$params);$password=$this->passwordhash->HashPassword($pwd);我收到这些错误-APHPErrorwasencounteredSeverity

php - Codeigniter:如何将文件路径上传到数据库?

我正在尝试将文件路径放入数据库,我已经上传了文件,但我不知道如何获取文件路径以将其放入数据库?这是Controller:load->model('insert_article');}publicfunctionindex(){$this->load->view('dogo/dashboard.php');}//addnewposttodatabaseincludinguploadingimagepublicfunctionnew_post(){//usedforthedropdownmenu(category)$this->load->model('dogo_cat');$data['

php - CakePHP、CodeIgniter 和 FuelPHP - 您更喜欢哪个,为什么?

我最近一直在研究学习PHP框架,并发现了这三个流行的选择。他们似乎都有相似的方法和方法,我不确定从哪里开始。如果您正在或一直在使用其中任何一个,我将不胜感激任何您可能想要分享的关于它们的优点、缺点或其他信息。我在考虑这些框架时考虑了以下几点:-哪一个具有最好的多语言支持?-哪个最容易实现/开始?-哪个最具前瞻性和通用性(即使用MongoDB等NoSQL数据库)? 最佳答案 我一直在使用所有提到的框架,但我真的很喜欢使用codeigniter框架,因为它非常轻巧,不会干扰我的工作流程来做太多我不想做的事情。i18n和多语言支持非常简单

php - codeigniter 中的动态页面控件

在我的CI项目中,我想使用一个完整的动态页面控件。所以,我有两个Controller方法,用于加载php文件。模型控件的查询基于url段。除了index.php文件外,所有页面输出都根据url和数据库结果在viewsphp文件中自动生成。这是正确的方法吗?Controllerpublicfunctionindex(){$data['title']="Index";$data['nav']=$this->content_model->get_index_nav();//TODO$this->load->view('templates/header',$data);$this->load-

php - 连接到第二个数据库在 CodeIgniter 中不起作用

我正在尝试将phpbb3与代码点火器集成。我非常成功,但我正在尝试访问论坛数据库,但它无法正常工作。这是目前我的数据库文件中的内容。/**FORUMDATABASE**/$active_group='forum';$active_record=TRUE;$db['forum']['hostname']='localhost';$db['forum']['username']='root';$db['forum']['password']='root';$db['forum']['database']='phpbb';$db['forum']['dbdriver']='mysqli';$