doudu161481 2014-03-27 17:30 采纳率: 100%
浏览 33
已采纳

无法调用视图

i have to a controller with name about.php in controller folder. now in view folder i have a view with name about.php. in index.php view i want to call that view with the link but it is not calling i am very new to Codeignitor.

This is my calling code in index.php

<a href="<?php echo base_url();?>About/about">About Us</a>

This is my controller code about.php in controller folder.

class About extends CI_Controller {

    function index(){

        $this->load->view('about');
    }

}
  • 写回答

2条回答 默认 最新

  • drpiqlzrh62917192 2014-03-27 17:34
    关注

    Your view should be called about.php and be in the views folder.

    Your controller is then calling this view (correctly) called about.

    Therefore a correct link to this view would be the following:

    <a href="<?= site_url('about'); ?>">About Us</a>
    

    You can read about the differences between base_url and site_url here.

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

报告相同问题?

悬赏问题

  • ¥15 从Freecad中宏下载的DesignSPHysics,出现如下问题是什么原因导致的(语言-python)
  • ¥30 notepad++ 自定义代码补全提示
  • ¥15 MATLAB有限差分法解一维边值问题
  • ¥200 内网渗透测试 横向渗透 Windows漏洞 Windows权限维持
  • ¥15 数据结构图的相关代码实现
  • ¥15 python中aiohttp.client_exceptions.ContentTypeError
  • ¥30 DeepLung肺结节检测生成最大froc值对应的epoch报错
  • ¥15 信号发生器如何将频率调大,步尽值改成10
  • ¥15 keil 5 编程智能家具,风扇台灯开关,人体感应等
  • ¥100 找一名渗透方面的专家