What command in php does what html_safe
in Ruby on rails
?
I have just found htmlspecialchars
, but it doesn't do what i need
I just want to use im my mailer <h1><? 'php some php code'.html_safe?> </h1>
.
What command in php does what html_safe
in Ruby on rails
?
I have just found htmlspecialchars
, but it doesn't do what i need
I just want to use im my mailer <h1><? 'php some php code'.html_safe?> </h1>
.
Not knowing rails, I had to lookup the function. From what I understood, it basically asserts that the string is "fine"/is not a threat. Again, I don't know how it works in rails, but in PhP, every string is assumed safe, and it's the dev who has to take measures if he considers a string could be unsafe (using, for instance, htmlspecialchars ).
If all I said sounds right, you would want to simple echo the string
<h1><?php echo $string ?></h1>
or, using the
<h1><?= $string ?></h1>
If you want to insert it as a link, you have to manually write it as
<h1><a href="<?= $string ?>"></a></h1>
Additionally, if the string was an encoded url, you'd want to use
<?= urldecode($string) ?>
Hope this helps