Tag: codeigniter

如何在codeigniter活动logging中插入查询后获取最后一个插入ID

我有一个插入查询(活动logging样式)用于插入表单字段到MySQL表中。 我想获取插入操作的最后一个自动递增的ID作为我的查询的返回值,但我有一些问题。 控制器内部: function add_post(){ $post_data = array( 'id' => '', 'user_id' => '11330', 'content' => $this->input->post('poster_textarea'), 'date_time' => date("Ymd H:i:s"), 'status' => '1' ); return $this->blog_model->add_post($post_data); } 和内部模型: function add_post($post_data){ $this->db->trans_start(); $this->db->insert('posts',$post_data); $this->db->trans_complete(); return $this->db->insert_id(); } 我没有得到任何模型中的add_post的返回

我在哪里可以在Codeigniter中放置图像文件,css,js等?

把css文件夹和图像文件夹放在哪里可以接受? 我在想视图文件夹里面? 然而,控制器总是将path重新路由到基本URL,所以我必须指定.html文件中的path到它所在的位置,这是多余的。

CodeIgniter activerecord,检索最后一个插入ID?

是否有任何选项可以获取CodeIgniter中新logging的最后一个插入ID? $last_id = $this->db->insert('tablename', array('firstcolumn' => 'value', 'secondcolumn' => 'value') ); 考虑到字段id(自动增量)firstcolumn和secondcolumn的表格consits。 这样你可以在下面的代码中使用插入ID。

我目前使用哪个版本的CodeIgniter?

快速的问题。 有没有类似于phpinfo() – 那将显示CodeIgniter的版本? 谢谢。

我应该如何为CodeIgniterselect一个authentication库?

我看到有几个 。 哪些维护和易于使用? 他们有什么优点和缺点?

使用PHP框架还是不?

我已经开始使用PHP编写一些应用程序,而且我越来越熟悉这种语言。 有人告诉我有关CakePHP和CodeIgniter的信息。 我想更好地理解这些如何帮助我,是否值得花时间学习一个框架?

如何将WordPress模板与CodeIgniter整合

如何整合CodeIgniter和WordPress,使WordPress博客的外观和感觉/模板被转移到CodeIgniter创build的页面上?

只有variables引用应该由引用返回 – Codeigniter

服务器PHP升级之后,我在Apache 2.0上获得了PHP 5.6.2版的以下错误 A PHP Error was encountered Severity: Notice Message: Only variable references should be returned by reference Filename: core/Common.php Line Number: 257 我该如何解决这个问题?

代码1的SSL操作失败:dh键太小

我正在通过SSL连接到我的数据库Google Cloud SQL。 我使用codeigniter 3.0来这样做,虽然mysqli驱动程序有点修改,以允许此function。 它已经运行好几个月了。 但是它刚刚开始返回这个警告: Message: mysqli::real_connect(): SSL operation failed with code 1. OpenSSL Error messages: error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small 我假设DH Key is too small是主要问题,但我不知道这意味着什么。 我已经使用Diffie-Hellman密钥交换,以及“键太小”的消息,但我没有太多的运气。 这是否表示服务器上的密钥已被篡改? 我已经检查了最近修改的date – 没有exception的近期访问。 这可能是我的服务器做了一些升级到PHP或他们的服务器configuration,这可能会导致此打破,但我想检查,确保它不是别的。 感谢有关这个问题的任何见解/可读材料。

上传一个CSV到Codeigniter

有其他人有问题上传到Codeigniter的CSV文件? 我得到一个非常恼人的“你正在尝试上传的文件types是不允许的。” 错误,即使我已经非常明确地设置上传types。 这是我的代码(应该是相当标准的东西): function doUpload() { $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'text/plain|text/csv|csv'; $config['max_size'] = '5000'; $config['file_name'] = 'upload' . time(); $this->load->library('upload', $config); if(!$this->upload->do_upload()) echo $this->upload->display_errors(); else { $file_info = $this->upload->data(); $csvfilepath = "uploads/" . $file_info['file_name']; $this->addfromcsv($csvfilepath); } } 我试图覆盖我允许的types的所有基地 – 也许我错过了一个? 感谢您的帮助!