codeigniter

codeigniter view, add, update and delete

纵饮孤独 提交于 2020-01-12 05:47:07
问题 I'm newbie in codeigniter and still learning. Anyone can help for sample in basic view, add, update, delete operation and queries in codeigniter will gladly appreciated. Just a simple one like creating addressbook for newbie. thanks, best regards 回答1: Some sample queries in Codeigniter class Names extends Model { function addRecord($yourname) { $this->db->set("name", $yourname); $this->db->insert("names"); return $this->db->_error_number(); // return the error occurred in last query }

Remove index.php of Codeigniter on IIS?

蹲街弑〆低调 提交于 2020-01-12 03:51:09
问题 I understand I can remove the 'index.php' part of the url with the following web.config code: <rewrite> <rules> <rule name="Rule" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" /> </conditions> <action type=

Codeigniter redirect not preserving HTTPS in relative redirects

天涯浪子 提交于 2020-01-12 02:21:39
问题 I have a site which has a public and a private area. The private area should be served via HTTPS. I want to redirect once to an explicit HTTPS url, and then, using relative URLS, have all the links be secure. When the user logs out, I will explicitly link to an absolute non-secure HTTP URL. My login form is shown a non-secure site via regular HTTP. My login form posts to https://www.mysite.com/login/validate , which loads using a secure connection. My logs show that Apache is loading the URL

Codeigniter redirect not preserving HTTPS in relative redirects

巧了我就是萌 提交于 2020-01-12 02:21:13
问题 I have a site which has a public and a private area. The private area should be served via HTTPS. I want to redirect once to an explicit HTTPS url, and then, using relative URLS, have all the links be secure. When the user logs out, I will explicitly link to an absolute non-secure HTTP URL. My login form is shown a non-secure site via regular HTTP. My login form posts to https://www.mysite.com/login/validate , which loads using a secure connection. My logs show that Apache is loading the URL

CodeIgniter 框架使用之分页使用

十年热恋 提交于 2020-01-12 00:19:07
php代码部分 < ? php defined ( 'BASEPATH' ) OR exit ( 'No direct script access allowed' ) ; class Demo extends CI_Controller { public function fenye ( ) { //加载分页类 $ this - > load - > library ( 'pagination' ) ; //完整的 URL 路径通向包含分页控制器类/方法 $config [ 'base_url' ] = site_url ( 'demo/fenye' ) ; //总记录数 $count = $ this - > db - > count_all_results ( 'goods' ) ; //分页的数据总行数,查询数据库得到的数据总量。 $config [ 'total_rows' ] = $count ; //每页显示多条 $config [ 'per_page' ] = '5' ; //放在你当前页码的前面和后面的“数字”链接的数量 $config [ 'num_links' ] = 2 ; //整个分页周围围绕一些标签 $config [ 'full_tag_open' ] = '<ul class="pagination">' ; $config [ 'full_tag

Error while opening an Excel file that generated using phpExcel

南楼画角 提交于 2020-01-11 14:15:11
问题 I am trying to generate an Excel file using phpExcel library in Codeigniter . The problem is that while downloading the file it shows characters in in undifined formats While opening the downloaded file it shows the message that is an different format, please refer the pic and while opening the file content as and my code stuff is: if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $this->load->library('excel'); $sheet = new PHPExcel(); $objWorkSheet = $sheet->createSheet();

Why are pagination links not working for me in CodeIgniter?

人走茶凉 提交于 2020-01-11 14:10:13
问题 I'm trying to use codeigniter pagination for my products so there are multiple pages which products but its not working for me and I don't know why.. This is my pagination function in my controller: //code om in allecadeaus te bepalen hoeveel producten er per pagina zitten public function pagination() { //load pagination library $this->load->library('pagination'); //laad Products_model voor pagination $this->load->model('Pagination_model'); $this->load->model('Product_model'); $config = array

Codeigniter: Use of load_class

拥有回忆 提交于 2020-01-11 13:54:12
问题 I am writing my own logging class to save data in a DB. As I looked how CI is doing I noticed there is a log_message() function which handles the logging. There is a load_class function I can't assign to anything in the CI user guide. 1 Why do they put this into an extra function? 2 What/where loads this function files from? Hope there are some CI guys how can answer :-) 回答1: Short answer: You can write your own log class to override the default CI class: <?php // this file is /application

Sending PHP GET data to server using Html links

Deadly 提交于 2020-01-11 13:24:17
问题 I haven't wrote PHP GET requests in a while. So I'm a little rusty. But how do I send GET data using an Html link. If I use jQuery's get method's I know how to do it, but I was just wondering if there is a simpler way using the href in Html or something similar. 回答1: Put the parameters behind the url: index.php?param1=yes&param2=no Then you can read the variables over $_GET echo $_GET['param1']; But this are PHP basics. Perhaps you should read the documentation before. In jQuery with an ajax

Codeigniter image upload not working

时间秒杀一切 提交于 2020-01-11 12:33:13
问题 I can't get my images to upload no matter what i do. Below is the code that is in my model: function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); return $error; } else { $data = array('upload_data' => $this->upload-