Answer the question
In order to leave comments, you need to log in
Why might htmlspecialchars_decode not work?
The situation is this:
I am writing my ticket system for the user's personal account. I accept the text of the message from the user,
convert the inserted links into clickable ones, and then convert the html tags into HTML entities.
$text = preg_replace("/\b((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)([\?\w+\.\=]+)([\&\w+\.\=]+)\b/i", "<a href=\"http$3://$4$5$6$7$8\" target=\"_blank\">$2$4$5$6$7$8</a>", $text);
$text = htmlspecialchars($text);
<a href="https://vk.com/" target="_blank">https://vk.com/</a>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question