简体   繁体   English

为什么将“ a”转换为

[英]Why 'a' convert to &nbsp

I have problem. 我有问题。 I use wordpress and from yesterday do not work link In database i have code: 我使用wordpress,从昨天开始不起作用,链接在数据库中,我有代码:

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

but in text editor in wordpress i have 但是在WordPress的文本编辑器中

&nbsp text &nbsp

I have no idea why a convert to &nbsp 我不知道为什么要转换为&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> 我在数据库中检查了此文本,然后看到了<a href="dakjhd">text</a>
  3. I check in text editor this text and i see &nbsp text &nbsp 我在文本编辑器中签入了此文本,然后看到&nbsp text &nbsp
  4. I don't know. 我不知道。

Your code is probably using strip_tags() to remove the tags from the actual HTML. 您的代码可能使用strip_tags()从实际的HTML中删除标签。 You can use html_entity_decode to bring back it to its original form. 您可以使用html_entity_decode将其恢复为原始格式。

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! 希望能消除您的疑问!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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