douaonong7807 2017-07-20 16:11
浏览 70

URI路由不起作用

I started working on a platform on CodeIgniter thanks to my work. The platform was started since before, so i just took the project. The thing is that i hadn't work with CI, so i just had a fast tutorial, and started developing based on how the platform was built. Now, to start, i decided to make a new page to to put a list of objects and understand a little how the PHP communicated with the HTML. The problem is that, when i go to the URL that i defined on routes.php, it gives an error "Requested resource does not exist", and i don't know what i'm doing wrong, while something similar works on other modules of the platform.

The files i'm using are:

list.php

// stuff
        <?php if (has_access('agroindustrias')): ?>
            <li class="<?php get_li_class('agroindustrias', $active); ?>" >
                <a href="<?php echo base_url('administracion/agroindustria'); ?>">Agroindustrias</a>
            </li>
        <?php endif ?>
// stuff

agroindustria.php

<?php 
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Agroindustria extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('agroindustria_model', 'agroindustria');
    }

    public function index($offset = 0)
    {
        $data['links'] = $this->paginate($this->agroindustria, 'agroindustrias', $offset);
        $data['permisos'] = $this->getPermissions('usuario');
        $data['active'] = 'usuarios';
        $data['agroindustrias'] = $this->agroindustria->limit($this->limit, $offset)->get_all();
        $data['submenu'] = $this->load->view('administracion/menu', $data, true);

        $this->template->write_view('content', 'administracion/agroindustrias/list', $data);
        $this->template->render();
    }

}

routes.php(Updated with all the file, only the one before "reportes" doesn't work)

$route['administracion/agroindustria'] = 'agroindustria/index';

My URL is: http://localhost/work/administracion/agroindustria

The other controllers works with something similar, reason that i don't know what i'm doing wrong, if i still need to add something to another file, or if something that i wrote is wrong. Thanks in advance.

  • 写回答

2条回答 默认 最新

  • dtysql0586 2017-07-20 21:52
    关注

    After the things that @Antony told me to check, i was able to find the error, it wasn't actually an error, just that the people before worked very much in the platform, that i did not undertand the mothodology to add new modules to the platform. All that i needed to do was register the new module, and the platform added the new URL as i wanted. Thanks Antony for your help!

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大