视频例子的问题
我按视频中的例子建立BLOG,webroot/index.php/blog/这个能访问, 但做到 有 Comment 链接的时候,为什么 浏览webroot/index.php/blog/comments 显示的是找不到文件?路径没有错啊,是配置有问题吗? 贴出你的控制器代码! <?phpclass Blog extends Controller {
function Blog()
{
parent::Controller();
//$this->load->scaffolding("entries");
//$this->load->database();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title']="MyBlog";
$data['heading']="Blog Heading";
$data['todo']=array('clean house','eat lunch','call mother');
$data['query']=$this->db->get('entries');
$this->load->view('blog_view',$data);
}
function comments()
{
$data['title']="MyComments";
$data['heading']="Blog comments";
//$data['query']=$this->db->get('entries');
$this->load->view('comment_view',$data);
}
function comment_insert()
{
echo "good!";
}
}
?> 再发次清楚点的
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title']="MyBlog";
$data['heading']="Blog Heading";
$data['todo']=array('clean house','eat lunch','call mother');
$data['query']=$this->db->get('entries');
$this->load->view('blog_view',$data);
}
function comments()
{
$data['title']="MyComments";
$data['heading']="Blog comments";
$this->load->view('comment_view',$data);
}
function comment_insert()
{
echo "good!";
}
}
?>
看这个控制器代码没有问题,应该是 Web 服务器的问题。 webroot/index.php/blog/comments不行,那么webroot/index.php/blog/comments/呢?(注意最后多一条斜杠) 我告诉他试试加斜杠,他说也不行,我看了一下,他用的是 IIS,应该是 IIS 的问题,并且他的 PHP 是 CGI 模式的。
页:
[1]