dtf0925 2017-09-22 10:42
浏览 50
已采纳

如何在codeigniter中调用控制器方法?

When i use URL(http://localhost/ci_framework/Temp).It successfully loaded my template.

<?php
    defined('BASEPATH') OR exit('No direct script access allowed');
     class Temp extends CI_Controller {
     public function index()
     {
        $this->load->view('index');
     }
     public function forward(){
         $this->load->view('index');
     }      
    }

?>

But when load same view(index) by adding their method name at the controller(http://localhost/ci_framework/Temp/forward). It fails to load Bootstrap files,java script files.

I have wasted 3 hours.Tell friends about possible solutions.Looking forward..

  • 写回答

2条回答 默认 最新

  • douwei7471 2017-09-22 10:48
    关注

    It appears you are using relative paths for your CSS and JavaScript assets. Instead you should use absolute paths so that your asset includes are the same regardless of the current URL.

    For example if you had /css/style.css:

    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 电脑拓展屏桌面被莫名遮挡
  • ¥20 ensp,用局域网解决
  • ¥15 Python语言实验
  • ¥15 我每周要在投影仪优酷上自动连续播放112场电影,我每一周遥控操作一次投影仪,并使得电影永远不重复播放,请问怎样操作好呢?有那么多电影看吗?
  • ¥20 电脑重启停留在grub界面,引导出错需修复
  • ¥15 matlab透明图叠加
  • ¥50 基于stm32l4系列 使用blunrg-ms的ble gatt 创建 hid 服务失败
  • ¥150 计算DC/DC变换器平均模型中的参数mu
  • ¥25 C语言代码,大家帮帮我
  • ¥50 关于#html5#的问题:H5页面用户手机返回的时候跳转到指定页面例如(语言-javascript)