Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在codeigniter中查看静态页面_Php_Codeigniter - Fatal编程技术网

Php 在codeigniter中查看静态页面

Php 在codeigniter中查看静态页面,php,codeigniter,Php,Codeigniter,我想查看的网页与链接等不是在格式和格式 如何执行此操作?在/config/route.php中为特定的静态页面设置路由 <?php class Page extends CI_Controller{ function index(){ $this->view('home'); } public function view($page = 'home') { if ( ! file_exists('applicati

我想查看的网页与链接等不是在格式和格式


如何执行此操作?

在/config/route.php中为特定的静态页面设置路由

<?php
class Page extends CI_Controller{

    function index(){
        $this->view('home');
    }

    public function view($page = 'home')
    {

        if ( ! file_exists('application/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);

    }

在/config/route.php中为特定的静态页面设置路由

<?php
class Page extends CI_Controller{

    function index(){
        $this->view('home');
    }

    public function view($page = 'home')
    {

        if ( ! file_exists('application/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);

    }
在config/routes.php中,可以添加路由:

$route['contact']   = 'site/page/contact';
在config/routes.php中,可以添加路由:

$route['contact']   = 'site/page/contact';
请帮我检查我的问题请帮我检查我的问题