コードイグナイタ2.1.0を使用してユーザー登録フォームを設計しようとしています。私はコントローラのregitration.phpに次のコードを使用してユーザーを追加しました。非オブジェクトコードイグナイタのメンバー関数run()を呼び出す
class Registration extends CI_Controller
{
function __construct() {
parent::__construct();
}
function index()
{
$data['main_content'] = 'registration';
// Checks to see if form validation rules were met an executed properly. If not, will return with registration form.
if ($this->form_validation->run('registration') === FALSE)
{
$data ['title'] = 'Registration';
$this->load->view('include/template', $data);
}
// If validation passes, information will be passed along to the MODEL to be processed and the account will be created.
else
{
$this->load->model('registration_model');
$this->registration_model->addUser();
$this->session->set_flashdata('success', 'Your account has been successfully created');
redirect(uri_string());
}
}
}
しかし、それは私にCall to a member function run() on a non-object
のエラーを示しました。どのように私はそれを修正するのですか?
$ this-> load-> libraryメソッド( 'form_validation')にこれを追加します。これを含める – Ghostman
私はイグナイタを新しくしました。このコードをどこに置かなければならないのかを教えてください。 – designersvsoft
私の更新された回答を参照してください – Ghostman