|
我按视频中的例子建立BLOG,webroot/index.php/blog/ 这个能访问, 但做到 有 Comment 链接的时候,为什么 浏览webroot/index.php/blog/comments 显示的是找不到文件?路径没有错啊,是配置有问题吗?
| |
|
<?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!"; } } ?> | |
|
再发次清楚点的
PHP复制代码 <?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/呢?(注意最后多一条斜杠)
| |