【发布时间】:2016-05-09 11:34:34
【问题描述】:
我在 codeigniter 中创建了一个控制器。问题是当我在 url 中点击控制器名称和函数名称时,它给了我找不到 404 的错误。我是 codeigniter 的新手,我不明白我哪里出错了
这是我的控制器
<?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 中的大部分解决方案,然后我问了这个问题。所以我要求不要将此问题添加到重复中。我想要解决我的问题。任何帮助都是可观的
谢谢
【问题讨论】:
-
你在地址栏写了什么网址?
-
@ManinderpreetSingh 感谢您的回复,但这些都不起作用
-
@Hassaan 我正在使用这个网址 localhost/w3crud/Home/index
-
您的视图文件是否位于
/application/views/home_view.php? -
你没有
index功能,所以使用这个url:localhost/w3crud/index.php/home/you
标签: php codeigniter