Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 使用codeigniter在索引函数中传递两个参数_Function_Codeigniter_Indexing_Routes - Fatal编程技术网

Function 使用codeigniter在索引函数中传递两个参数

Function 使用codeigniter在索引函数中传递两个参数,function,codeigniter,indexing,routes,Function,Codeigniter,Indexing,Routes,我想使用codeigniter在索引函数中传递两个参数,但它给我的错误我不知道为什么它给我的错误。 这是我的控制器 function index($one = null,$two = null) { $data['title'] = "Product Page "; $this->load->view('home/header/header',$data); $this->load->view('home/css/css'); $this-

我想使用codeigniter在索引函数中传递两个参数,但它给我的错误我不知道为什么它给我的错误。 这是我的控制器

function index($one = null,$two = null)
{
    $data['title'] = "Product Page ";
    $this->load->view('home/header/header',$data);
    $this->load->view('home/css/css');
    $this->load->view('home/navbar/navbar2');
    $this->load->view('products/product');
    $this->load->view('home/footer/footer');
    $this->load->view('home/js/js');
}
这是我的路线设置

$route['product/(:any)'] = 'product/index/$1'; 

当我在一个参数中设置索引函数时,它可以正常工作,但不能在两个参数中工作。

您可以尝试使用它,它将正常工作

$route['product/(.*)/(.*)']='product/index/$1/$2';

你可以试试这个,它会有用的

$route['product/(.*)/(.*)']='product/index/$1/$2';