我有一个名为 Categories 的控制器和一个名为 index 的函数,带有 1 个参数 $cat_id
所以它看起来像这样:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class categories extends CI_Controller {
function __construct(){
parent::__construct();
}
public function index($cat_id = null){
}
}
当我从浏览器调用它时问题就来了......我用这个:
http://www.mysite.dev/categories/12311323
但返回 404 错误页面
相反,如果我使用
http://www.mysite.dev/categories/index/12313131
会正常工作...
我如何确保它不需要索引功能的 URL 中的索引?