2016-03-29 10 views
0

エラーが発生しました要求されたファイルを読み込めません:login_view.php。私はログインコントローラを持っています要求されたファイルを読み込めません:login_view.php

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Login extends CI_Controller { 

function __construct() 
{ 
    parent::__construct(); 
} 

function index() 
{ 
    $this->load->helper(array('form')); 
    $this->load->view('login_view'); 
} 

} 

?> 

とロードされているビュー。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title>Simple Login with CodeIgniter</title> 
</head> 
<body> 

    <?php echo validation_errors(); ?> 
    <?php echo form_open('verifylogin'); ?> 
    <label for="username">Username:</label> 
    <input type="text" size="20" id="username" name="username"/> 
    <br/> 
    <label for="password">Password:</label> 
    <input type="password" size="20" id="password" name="password"/> 
    <br/> 
    <input type="submit" value="Login"/> 
    </form> 
</body> 
</html> 

VerifyLoginページ

class VerifyLogin extends CI_Controller 
{ 
    function __construct() 
    { 
     parent::__construct(); 
     $this->load->model('user','',TRUE); 
    } 

    function index() 
    { 
     $this->load->library('form_validation'); 
     if($this->form_validation->run() == FALSE) 
     { 
       $this->load->view('login_view'); 
     } else 
      { 
       redirect('home', 'refresh'); 
      } 
     } 
} 

私を導いてください。ありがとう。

+0

ここにverifyloginのコードもあります。 –

+0

<?php class VerifyLoginはCI_Controllerを継承します。{ function __construct() { parent :: __ construct(); $ this-> load-> model( 'user'、 ''、TRUE); } function index() { $ this-> load-> library( 'form_validation'); if($ this-> form_validation-> run()== FALSE) { $ this-> load-> view( 'login_view'); } else { redirect( 'home'、 'refresh'); } } –

+0

ちょうど注:クラスとファイル名の最初の文字のみ大文字にする必要があります。ここで説明します。 http://www.codeigniter.com/user_guide/general/controllers.html#let-s-try-it-hello-world – user4419336

答えて

0

このエラーは、ロードしようとしているビューがデフォルトの「ビュー」の場所に存在しないことを意味します。それをサブディレクトリに置いたのですか? config内のビューフォルダの場所を編集しましたか?

+0

こんにちは、あなたのlogin_viewファイル名を確認し、また、ビューフォルダ内のlogin_viewファイルをチェックしてください。 – Divyesh

+0

私はhtdocs ..でコードイグナイタを抽出し、アプリケーション/ビューディレクトリに私のビューを配置しました –

+0

その完了..ありがとう皆さん。今私は別の問題に遭遇しました。フィールドにユーザー名とパスワードを入力しているとき。それはユーザのホームページには行かない。ユーザー名とパスワードはデータベース内で有効ですが、ログインページに残ります –

関連する問題