I have the code below:
<?php echo $fields->question; ?>
I specifically want to st开发者_如何转开发rip out any special characters that may cause an issue with php, how could I do that? Specifically "" is causing me a problem at the moment.
<?php echo htmlentities($fields->question, ENT_QUOTES, "UTF-8")?>
Have you tried the addslashes() native PHP function?
$foo = addslashes($fields->question);
echo $foo;
This won't strip them out, but it should prevent them from causing you any problems by escaping the quotes.
精彩评论