2016-12-09 2 views
0

вот мой Посмотреть login.phpНевозможно соединиться с Codeigniter

<?php 
defined('BASEPATH') OR exit('No direct script access allowed'); 
?><!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <title>Welcome</title> 

    <link rel="stylesheet" href="assets/css/bootstrap.min.css"> 
     <link rel="stylesheet" href="assets/css/signing.css"> 

    <link rel="stylesheet" href="assets/js/bootstrap.min.js"> 
</head> 
<body> 
<div class="container"> 

     <?php echo form_open('Login/validate_credentials',['class'=>'form-signin']); ?> 
     <h2 class="form-signin-heading">Please sign in</h2> 
     <label for="inputEmail" class="sr-only">Email address</label> 
     <input type="email" id="inputEmail" name ="username" class="form-control" placeholder="Email address" required autofocus> 
     <label for="inputPassword" class="sr-only">Password</label> 
     <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required> 
     <div class="checkbox"> 
      <label> 
      <input type="checkbox" value="remember-me"> Remember me 
      </label> 
     </div> 
     <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> 
     </form> 

    </div> `` 

здесь, как это выглядит

locahost/CI/

enter image description here

, когда я щелкните его, показывая следующую страницу,. Нет ошибок в журнале апача и журнал доступа или страницы журнала Error тузд enter image description here

страница Контролер здесь **

<?php 
class Login extends CI_Controller{ 
    public function index(){ 
     $this->load->view('login'); 
    } 
    public function validate_credentials() 
    { 
     $data =array(
      $username=$this->input->post('username'), 
      $password=$this->input->post('password') 
      ); 
     $this->load->model('Login'); 
     $result=$this->login->validate($data); 
     if($result==true) 
     { 
      redirect('welcome'); 
     } 
     else{ 
      echo "not found"; 
     } 
    } 
} 
?> 

Конфигурация

$config['base_url'] = 'http://localhost:8080/ci'; 
$config['index_page'] = 'index.php'; 

routes.conf */

$route['default_controller'] = 'login'; 
$route['404_override'] = ''; 
$route['translate_uri_dashes'] = FALSE; 

**

+0

версии Codeigniter вы использовали? –

ответ

1

Изменение конфигурации для

$config['base_url'] = 'http://localhost/ci'; 
$config['index_page'] = 'index.php'; 
0

Ваш CI не настроен правильно. Как в соответствии с вашими скриншотами: URL

Первый Скриншот: URL http://localhost/ci

Второй Скриншот: http://localhost:8080/ci

изменить конфигурацию:

$config['base_url'] = 'http://localhost/ci'; 
$config['index_page'] = 'index.php'; 
Смежные вопросы