开发者

CodeIgniter: show a view by typing its url

A newbie here: sorry if the question is too simple, been looking in tutorials but I don't seem to look properly.

I have the

$route['default_controller'] = "mainpage";

in routes.php working properly, and now I just want to view one of the php pages in views folder by typing its url:

http://myserver/folder/thepageIwantToSee

I get a 404 Not Found error. Do I have to use a controller? I just want to see it first before any linking,开发者_C百科 is there a way to do it?

Thanks a lot!


class yourcontroller extends CI_Controller {

     function pageiwanttosee()
     {
         code
         code

         $this->load->view('the_view_page', $data);
     }

 }


Yes, you can write a controller that displays the view specified.

http://myserver/showfile/folder/thepageIwantToSee , where showfile is your controller.

Don't forget to set some security check or disable this on production site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜