CodeIgniter中的URI路由


URI routing in CodeIgniter

这个链接可以使用site.tv/admin/edit/ (controllers/admin/edit.php),但不能使用site.tv/admin/reg/edit/ (controllers/admin/reg/edit.php)是不是到控制器的路径太长?

您的路由应该是index.php/class/METHOD/ID

报价来自application/config/routes.php

通常,URL字符串之间存在一对一的关系及其相应的控制器类/方法。URL通常遵循以下模式:

example.com/class/meethod/id/

例如

class test extends CI_Controller{
    public function hello() {
        echo 'hello world';
    }
    public function meep() {
        echo 'meeeeeep';
    }
    public function param($value){
            echo 'Your parameter is '. $value;
    }
}

那么你的url应该是index.php/test/helloindex.php/test/meepindex.php/test/param/whataeverhere

更新

如果你需要"多个包",为你的"包"创建子目录,比如在中

controllers
    ->admin
           ->reg
                ->myfile.php
                ->myfile2.php
           ->reg2
                ->myfile.php
                ->myfile2.php

然后在application/config/文件夹

下的routes.php中创建自定义路由

我认为这对CHMOD来说是个问题。检查reg-fils是否可读。