Codeigniter Uri字符串值出错

The codeigniter uri string value with hypen was replaced with underscore in query.

For example : http://domain.com//demo1/index.php/class/method/test-product

The URI : test-product was passed into the query with test_product , so the value is empty in the query result.

How to avoid this problem

Use URI Class to get the uri segment value like this way:

$this->uri->segment(n);

here $this->uri->segment(3) will return test-product

You can convert it

$data = str_replace('_','-',$data);