简体   繁体   English

CodeIgniter:没有加载输入类(或者我认为)

[英]CodeIgniter: Input class not being loaded (or so I think)

I'm trying to work with the CI framework (PHP), and not having much luck with the core "Input" class. 我正在尝试使用CI框架(PHP),并且对核心“输入”类没有太多运气。

Here's my code: 这是我的代码:

$user_name = $this->input->post('username');
$password = $this->input->post('password');

This is the result when I try to load the controller: 这是我尝试加载控制器时的结果:

A PHP Error was encountered 遇到PHP错误

Severity: Notice 严重性:注意

Message: Undefined property: Login::$input 消息:未定义属性:Login :: $ input

Filename: controllers/login.php 文件名:controllers / login.php

Line Number: 24 行号:24

Any Tips? 有小费吗?

Make sure that your controller extends CI_Controller and that you call the parent constructor in your own: 确保你的控制器扩展了CI_Controller并且你自己调用了父构造函数:

class Login extends CI_Controller {
    public function __construct() {
        parent::__construct();
    }
    /* the rest of your code... */
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM