Ragav
Ragav

Reputation: 1

Codeigniter Uri string values getting wrong

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

Upvotes: 0

Views: 190

Answers (2)

vijaykumar
vijaykumar

Reputation: 4806

You can convert it

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

Upvotes: 0

Suvash sarker
Suvash sarker

Reputation: 3170

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

Upvotes: 1

Related Questions