codeigniter

CodeIgniter: Can't load database from within a model

有些话、适合烂在心里 提交于 2020-02-15 18:34:14
问题 I've written a new model for my CodeIgniter framework. I'm trying to load the database from within the constructor function, but I'm getting the following error: Severity: Notice Message: Undefined property: userdb::$load Filename: models/userdb.php Line Number: 7 Fatal error: Call to a member function database() on a non-object in /var/www/abc/system/application/models/userdb.php on line 7 Here is my model: <?php class userdb extends Model { function __construct() { $this->load->database();

CodeIgniter: Can't load database from within a model

筅森魡賤 提交于 2020-02-15 18:33:35
问题 I've written a new model for my CodeIgniter framework. I'm trying to load the database from within the constructor function, but I'm getting the following error: Severity: Notice Message: Undefined property: userdb::$load Filename: models/userdb.php Line Number: 7 Fatal error: Call to a member function database() on a non-object in /var/www/abc/system/application/models/userdb.php on line 7 Here is my model: <?php class userdb extends Model { function __construct() { $this->load->database();

CodeIgniter 去掉 URL 中的 index.php

两盒软妹~` 提交于 2020-02-14 03:19:21
1,确保apache支持 mod_rewrite 1)打开Apache2.2\conf\httpd.conf 搜索 LoadModule rewrite_module modules/mod_rewrite.so (Apache2是这个) 去掉前面的# 2)搜索AllowOverride None 替换为 AllowOverride All(注意,有好几个) 2,在 CI 根目录下新建立一个配置文件,命名为: .htaccess,文件内容如下 : RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] 要注意 /index.php/$1 要根据你目录(Web 目录,比如 http://www. 34ways .com/index.php)的实际情况来定,比如网站根目录是 /34ways/index.php 则要写成 /34ways/index.php/$1 注意: RewriteCond $1 !^(index\.php|images|robots\.txt) 这里是需要忽略的路径和文件,比如可以这样来写: RewriteCond $1 !^(index\.php|images|robots\.txt|theme) 3, 修改

win7下CodeIgniter安装

依然范特西╮ 提交于 2020-02-14 02:59:33
一、CodeIgniter是什么 CodeIgniter 是一套给 PHP 网站开发者使用的应用程序开发框架和工具包。 它的目标是让你能够更快速的开发,它提供了日常任务中所需的大量类库, 以及简单的接口和逻辑结构。 简单来说就是一套开源的、轻量级的php框架 二、CodeIgniter下载 http://codeigniter.org.cn/ ,下载后解压。 三、CodeIgniter安装 上一篇已经写过xampp环境搭建,https://www.cnblogs.com/qingqing-919/p/11132244.html,将解压后的CodeIgniter 复制,粘贴到xampp安装目录\xampp\htdocs文件夹下。 四、测试CodeIgniter 是否安装成功 启动xampp中apache服务,自动方法在搭建中已经说过。找到xampp安装目录,双击目录下的:xampp-control.exe ,启动xampp的控制台,在这个控制台中对Apache启动。 浏览器中访问 http://localhost/CodeIgniter/index.php/Welcome(这里是我本机路径,如果存放路径不同需要改成跟自己本机一致) 这样就安装成功了。 来源: https://www.cnblogs.com/qingqing-919/p/11132402.html

去掉CodeIgniter URL中的index.php

China☆狼群 提交于 2020-02-13 09:05:12
CI默认的rewrite url中是类似这样的,例如你的CI根目录是在/CodeIgniter/下,你的下面的二级url就类似这样http://localhost /CodeIgniter/index.php/welcome。不太好看,怎么把其中的index.php取掉呢? 1. 打开apache的配置文件,conf/httpd.conf : LoadModule rewrite_module modules/mod_rewrite.so,把该行前的#去掉。 搜索 AllowOverride None(配置文件中有多处),看注释信息,将相关.htaccess的该行信息改为AllowOverride All。 2. 在CI的根目录下,即在index.php,system的同级目录下,建立.htaccess,直接建立该文件名的不会成功,可以先建立记事本文件,另存为该名的文件即可。内容如下(CI手册上也有介绍): 1 RewriteEngine on 2 RewriteCond $1 !^(index\.php|images|robots\.txt) 3 RewriteRule ^(.*)$ /index.php/$1 [L] 如果文件不是在www的根目录下,例如我的是:http://www.nowamagic.net/CodeIgniter/,第三行需要改写为RewriteRule ^

CodeIgniter: How to set a controller function to be a post route?

蹲街弑〆低调 提交于 2020-02-08 07:22:03
问题 I usually use something like: class User extends CI_Controller { public function save() { if($this->input->is_post()) { //my own method ...... } } } Is there any other way, eg. in Slim framework: post("/user/save", function() { ...... }); or in .Net MVC: [HttpPost] public ActionResult save(User model) { ...... } Or can CodeIgniter handle this in its route config file? Thanks for answer. 回答1: Codeigniter has no built-in support for REST. If you want it, you need to use third-party library or

JQuery each getting value of multiple table data in a table row

邮差的信 提交于 2020-02-08 05:22:06
问题 Hi there I have this table which has multiple rows. I want to know how to get certain data in each row of this table. In this table I needed to get the student number data and it's accompanying grade. <tbody> <?php foreach ($class_list_view as $student) { ?> <tr> <td class="studentnumber"><?= $student->studentnumber ?></td> <td><?= $student->lastname ?></td> <td><?= $student->firstname ?></td> <td><?= $student->middlename ?></td> <td><?= $student->level ?></td> <td><?= $student->year ?></td>

Codeigniter 利用加密Key(密钥)的对象注入漏洞

房东的猫 提交于 2020-02-08 02:40:59
http://drops.wooyun.org/papers/1449 原文链接:http://www.mehmetince.net/codeigniter-object-injection-vulnerability-via-encryption-key/ 0x00 背景 大家好,Codeigniter 是我最喜爱的PHP框架之一。和别人一样,我在这个框架中学习了PHP MVC编程。今天,我决定来分析一下Codeigniter的PHP 对象注入漏洞。 我在接下来的叙述中会把重点放在Codeigniter的Session会话机制上。所有我将会分析的method方法都在 CodeIgniter/system/libraries/Session.php 文件里。我在本研究过程中使用的是Codeigniter 2.1 版本。 0x01 Codeigniter Session会话机制 Codeigniter 使用PHP的序列化method方法来存储用户Session会话中的变量。但是Codeigniter Session会话机制并不像我们预期的那样工作。它把session会话的变量存在了客户端的cookie里面,大多数是在(服务器)硬盘上而不是用户COOKIE中。我不知道开发者们为什么这么设计。 下面的叙述摘自codeigniter的文档 The Session class stores

how do i pass a view variable to the controller in codeigniter?

强颜欢笑 提交于 2020-02-07 05:45:18
问题 My View :- <html> <?= link_tag(base_url().'css/simple.css'); ?> <body> <?php $this->load->helper('form'); ?> <?php $this->load->view('commentform'); ?> <?php $id=$this->uri->segment(3);?> <?php echo $id;?> </body> </html> i would like to use the variable $id in my controller.I'm using codeigniter by the way, and am a beginner. I would appreciate any help on this. 回答1: Well, ideally you wouldn't do it this way. You should assign the variable first in the controller and pass it to the view if

How to get CI pagination to work with a array();

我怕爱的太早我们不能终老 提交于 2020-02-06 08:33:42
问题 How can I get the codeigniter pagination to work with my $data['controller_files'][] = array() I cannot figure out best place to put the uri->segment(4) and per page limit. The pagination links work but not per page. Still shows full list of files on my table. Routes // Extensions $route['admin/extension/permissions'] = "admin/extension/extension_permissions/index"; $route['admin/extension/permissions/(:any)'] = "admin/extension/extension_permissions/index/$1"; Controller <?php class