codeigniter 未找到CI页

kcugc4gi  于 2022-12-07  发布在  其他
关注(0)|答案(3)|浏览(126)

page error

我的htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

我的控制器

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

class Auth extends CI_Controller
{
public function __construct()
{
    parent::__construct();
    $this->load->library('form_validation');
}

public function index()
{
    $this->form_validation->set_rules('username', 'Email', 'required|trim');
    $this->form_validation->set_rules('password', 'Email', 'required|trim');
    if ($this->form_validation->run() == FALSE) {
        # code...
        $data['title'] = 'Login';
        $this->load->view('templates/auth_header', $data);
        $this->load->view('auth/login');
        $this->load->view('templates/auth_footer');
    } else {
        $this->_login();
    }
}

有人知道我的问题吗?我认为我的语法是正确的,但页面仍然没有找到。有人帮助我吗,我仍然是一个初学者在该领域的程序员

9fkzdhlc

9fkzdhlc1#

请将此htaccess文件添加到应用程序文件夹中。它可能会有所帮助

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

您的htaccess文件在应用程序文件夹之外。这也是必需的。

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
uqdfh47h

uqdfh47h2#

**First, you check, that the post data is checked if the condition or else condition inside echo and exit the post data.**
    
    public function index()
    {
        $this->form_validation->set_rules('username', 'Email', 'required|trim');
        $this->form_validation->set_rules('password', 'Email', 'required|trim');
        if ($this->form_validation->run() == FALSE) {
      echo " If stmt ";
 exit();
            # code...
            $data['title'] = 'Login';
           
        } else {
      echo " else stmt";
     exit();
            $this->_login();
        }
    }
kg7wmglp

kg7wmglp3#

请将文件名更改为(auth/Login)首字母大写

相关问题