简体   繁体   中英

Why 'a' convert to &nbsp

I have problem. I use wordpress and from yesterday do not work link In database i have code:

<a href="dakjhd">text</a>

but in text editor in wordpress i have

&nbsp text &nbsp

I have no idea why a convert to &nbsp

Now i can't add link...

Please help

In step:

  1. Add link to my text
  2. I check in database this text and i see <a href="dakjhd">text</a>
  3. I check in text editor this text and i see &nbsp text &nbsp
  4. I don't know.

Your code is probably using strip_tags() to remove the tags from the actual HTML. You can use html_entity_decode to bring back it to its original form.

Example:

<?php

$link = '<a href="dakjhd">text</a>';

$a = strip_tags($link);
$b = htmlentities($link);
$c = html_entity_decode($b);

echo $a; // output: text
echo $b; //output: <a href="dakjhd">text</a>
echo $c; //output: the actual link

?>

Hope that clears your doubt!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM