zhizhesky 发表于 2008-2-2 17:15:47

视频例子的问题

我按视频中的例子建立BLOG,webroot/index.php/blog/这个能访问, 但做到 有 Comment 链接的时候,为什么 浏览webroot/index.php/blog/comments 显示的是找不到文件?路径没有错啊,是配置有问题吗?

Hex 发表于 2008-2-2 17:17:11

贴出你的控制器代码!

zhizhesky 发表于 2008-2-2 17:21:30

<?php

class 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!";
        }
}
?>

zhizhesky 发表于 2008-2-2 17:23:46

再发次清楚点的

<?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!";
        }
}
?>

Hex 发表于 2008-2-2 17:28:16

看这个控制器代码没有问题,应该是 Web 服务器的问题。

沧蓝 发表于 2008-2-2 19:26:53

webroot/index.php/blog/comments不行,那么webroot/index.php/blog/comments/呢?(注意最后多一条斜杠)

Hex 发表于 2008-2-2 21:17:34

我告诉他试试加斜杠,他说也不行,我看了一下,他用的是 IIS,应该是 IIS 的问题,并且他的 PHP 是 CGI 模式的。
页: [1]
查看完整版本: 视频例子的问题