In PHP I am trying to write a string in a file.
hi hello world<Data="Text">Vtt</Text> How are you
but writing this is showing the string with special characters such as <
and >
$a = htmlentities($m_str_val);
$str_final = html_entity_decode($a);
How can this can be solved?
The htmlentities() function converts all applicable entities into their HTML equivalent.
'
will become '
<
will become <
'
>
will become >
etc.
If you don't want the conversion to happen, don't use htmlentities(). Simply write $m_str_val
to the file as-is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.