codeigniter

how to remove index.php from codeigniter URL [duplicate]

喜夏-厌秋 提交于 2020-01-06 05:38:19
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: how to remove index.php from url in codeigniter ? I want to remove index.php from the codeigniter url. I have created .htaccess file and placed the following code on it (as found on the CodeIgniter website. But i can not access anything on the localhost. I get the error "Not Found", if i place the code in the .htaccessfile. RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$

How to merge row with same value in PHPExcel, array looping with if logic

橙三吉。 提交于 2020-01-06 05:27:08
问题 I need help for the looping logic in phpexcel, that can merge row with same transaction id here's the example code foreach ($transaction as $key => $value) { // I need if condition for $merge (ex. N4:N5) $excel->getActiveSheet()->mergeCells($merge); } i have tried some logic that compare last looping transaction id, with current transaction id. but my logic is still bad and doesnt work well. I want the result like this 回答1: The following solution was developed using PHPSpreadSheet, an upgrade

How do you do jquery serialize with CodeIgniter?

萝らか妹 提交于 2020-01-06 04:35:10
问题 I'm using jQuery and CodeIgniter to do this. Ok so basically I have a register form which asks the user for a username, password, and email. Once the form is submitted, jQuery would serialize the form and give it to a process page, echo the value out in the controller, and then the javascript would alert the post values in the original view. So far it isn't working. Nothing is being alerted. Here's my code: (The controller) register.php: <?php if (!defined('BASEPATH')) exit('No direct script

Call to a member function result() on boolean in CodeIgniter, SQL

China☆狼群 提交于 2020-01-06 04:34:08
问题 I'm trying to see what data is coming in $data['results'] on basis of search keyword but getting above mentioned fatal error every time, can somebody help me with it. My Controller public function execute_search() { $search_term = $this->input->post('search'); $data['results'] = $this->UserModel->get_results($search_term); print_r($results); die; //$this->load->view('search_result',$data); } My Model: public function get_results($search_term) { //var_dump($search_term);die; $this->db->select(

phpspreadsheet working on local but not on live

送分小仙女□ 提交于 2020-01-06 04:32:31
问题 I installed phpspreadsheet with composer in my Codeigniter project. It's working fine on local but throwing an error on the live environment: This site can’t be reached The webpage at http://www.xxxxxx.com/email/exportemail might be temporarily down or it may have moved permanently to a new web address. ERR_INVALID_RESPONSE My code: require(APPPATH . 'vendor/autoload.php'); use PhpOffice\PhpSpreadsheet\Helper\Sample; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet

Codeigniter blog application: replace post id with slug in the singe post url only

爷,独闯天下 提交于 2020-01-06 04:12:47
问题 I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4. I have been working for some time on this application and consequently, it has a lot of features. Most of these rely on the ids of posts, pages, etc. For SEO purposes, I would like to use friendly URLs, instead of ids to display the individual posts , so I have added a slug column to the posts table. The slugs are made from post titles, with this chunks of code in the Posts_model model and the Posts controller,

Get ASSOC array value by numeric index

人走茶凉 提交于 2020-01-06 04:05:38
问题 In all the examples of Codeigniter queries at https://www.codeigniter.com/user_guide/database/results.html, I find that the name of the field must be known to get its value. $query = $this->db->query("SELECT title,name,body FROM table"); foreach ($query->result() as $row) { echo $row->title; echo $row->name; echo $row->body; } For example, if I want to get the title , I will perform row->title . Is there a way to get the title using an index e.g. like $row[0] ? 回答1: Use result_array function

where to put robots.txt for a CodeIgniter

徘徊边缘 提交于 2020-01-06 03:31:50
问题 Where to place the robots.txt file in codeigniter. I dont no how to put where folder. User-agent: * Disallow: / 回答1: The robots.txt file MUST be placed in the document root of the host. It will not work in other locations. If your host is example.com, it needs to be accessible at http://example.com/robots.txt. 来源: https://stackoverflow.com/questions/30970833/where-to-put-robots-txt-for-a-codeigniter

call CodeIgniter Model with ajax

旧街凉风 提交于 2020-01-06 03:14:31
问题 I'm trying to call a function in one of my model but I would like to do so without going through a controller, is that possible? The code provided below doesn't work, I get 404 Not Found Javascript: $.ajax({ type: "POST", url: "/myApplication/usersModel/get_cash_player", success: function(result){ alert("ok"); } }); My model (located in usersModel.php) : public function get_cash_player(){ $currentUserID = $this->usersModel->get_user_id(); $query = $this->db ->select('cash') ->from('users') -

Run controller methods in background Codeigniter Windows

不想你离开。 提交于 2020-01-06 02:59:05
问题 I'll start with what my program does. The index function of controller takes an array of URLs and keywords and stores them in DB. Now the crawlLink method with take all the keywords and URLs. The URLs are searched for all the keywords and the sublinks of all the URLs are generated and again stored in DB which are also searched for the keywords. Keywords are searched in each link using search method. The sublinks are extracted from all the URLs using extract_links function. search and extract