Question

I am fetching '$' symbol from uri. And I have already added $ in permitted_uri_chars in config file. Later I am fetching data from database using that uri string. issue can be seen from below example.

MY Url is like this ....

.....com/search/shirt/$

My Example code is this ...

echo $this->uri->segment('3');
echo "<br>";
var_dump($this->uri->segment('3'));
echo "<br>";
$dol_sign = '$';
echo $dol_sign;
echo "<br>";
var_dump($dol_sign);

MY Output of above code is this ...

$
string(5) "$"
$
string(1) "$" 

it is taking segment as differently. that is why i m having issue in fetching data from DB matching with URI segment.

Was it helpful?

Solution

Your first sign is an HTML encoded entity - if you see the source of the page you'll see &amp; instead of a simple &.

You can use the PHP html_entity_decode() function to decode it into the normal character, or test against it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top