找不到Codeigniter控制器 [英] Codeigniter controller not found

查看:68
本文介绍了找不到Codeigniter控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在codeigniter中创建了一个控制器。问题是,当我在URL中命中控制器名称和函数名称时,它给了我找不到404的错误。我是Codeigniter的新手,我不明白我要去哪里哪里

I have create a controller in codeigniter. The problem is that when I hit the controller name and function name in url then Its give me error that 404 not found. I am new to codeigniter and I did not understand where I am going wrong

这是我的控制器

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

class Home extends CI_Controller{

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

function you(){
$this->load->view('home_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>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>My First CodeIgniter Practice</title>
 </head>
 <body>
 <h1> HELLO CI Buddy...!</h1>
 </body>
 </html>

我正在codeigniter上创建我的第一个项目,但我一直陷在这个问题中。我已经尝试了大多数解决方案从stackoverflow,然后我问这个问题。因此,我的要求是不要添加此问题重复。我想要解决我的问题。

I am creating my first project on codeigniter and I stuck in this problem.I already try most of the solution from the stackoverflow and after that I asking this question. So Its my request not to add this question to duplicate. I want solution for my problem. any help is appreciable

谢谢

推荐答案

您的问题可能是由于由于以下任何原因

Your issue may be due to any of the following reason


  • 控制器文件名的首字母应为大写字母,即Home.php。

  • 请检查您的主页文件名

  • 如果问题出在您的URL中,请使用URL localhost / w3crud / index.php / home / you
    ,然后编辑您的.htaccess文件

这篇关于找不到Codeigniter控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆