doulan3966 2014-07-25 09:48
浏览 14
已采纳

将html页面添加到codeigniter项目

I crated a simple html page mypage.html. It simply post data to upload.php all this run fine.

But now I wanted to add this page in my codeigniter project. But it could not added. How I can add this page to my codeigniter project. such that I only type mypage.html in url.

this is error

404 Page Not Found

The page you requested was not found.

  • 写回答

2条回答 默认 最新

  • drmy1050 2014-07-25 09:53
    关注

    You need to create a controller, and then load the .html template from that controller.

    Example:

    Create a controller called 'Page.php'. Create a function within this controller called mypage(). Within mypage(), simply load your template:

    <?php
    
    class Page extends CI_Controller {
    
        public function mypage()
        {
            $this->load->view('mypage.html');
        }
    }
    

    Ensure your .html template is in the 'Views' folder. Then simply access via the browser by entering localhost/page/mypage

    Codeigniter provide great docs and tutorials. Check them out here http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题