oh yes, and i've the same problem in a perl script should anyone be able to suggest the fix for that..![]()
hey there.. been playing with mod_rewrite to make my pages more search engine friendly but some of the categories my script serves up contain the '/' character, which stops the server being able to find the script.
I've tried
$string=str_replace("/","",$string);
but it doesn't seem to do anything. Anybody got any ideas?
thanks,
jonny
oh yes, and i've the same problem in a perl script should anyone be able to suggest the fix for that..![]()
Try
http://www.zend.com/manual/function.stripslashes.php
echo stripslashes($str);
Jason
stripslashes probably won't work - it removes the \ character not the /.
There's no reason whyshouldn't work.PHP Code:$string=str_replace("/","",$string);
Just though why it might not work - the / probably needs to be escaped, so try -
and the same possibly goes for Perl - I think its something to do with regular expressions.PHP Code:$string=str_replace("\\/","",$string);
hmm yeah that's what i thought. I fixed the prob in perl - I had to use \/ not / but it doesn't seem to work in php for some reason..
....ug sorry im being a right muppet, doing the str_replace in a different bit of code to the one displaying the link! tsk tsk.. well thanku everyone all the same!![]()
One thing for the future, try using single quotes (') rather than double ('') as php doesn't check for escape chars etc in single quoted strings. It also doesn't check for inserted variables, so single quoted strings are quicker if you don't need then.
e.g.Would print: -Code:<? $val='hello'; echo "$val world\n"; echo '$val world\n'; ?>(\n is a new-line character)Code:Hello World $val world\n
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks