PHP如何在变量中使用html标签/实体?

I have content that I want to display in a textarea. And on a another page in a div. The content I got from inside my database. And was inserted in the database with CKeditor. Sound easy, right?

The problem is that when I use echo or print I am getting <b>Some content</b> instead of Some content.

Believe it or not I spend 6 hours already trying to solve this problem. What is normal amount for me to spend on a problem. Only normally I am at least one step closer solving the problem. But now I am still as clueless as I started.

And yes I am using: <meta charset="utf-8">

My code(Just a basic echo, since I don`t know what to do)

<textarea ><?php echo $content; ?></textarea>

Current output:

<li><s><em><strong><span class="marker">Dit is gewijzigd?</span></strong>

But I would like this:

Dit is gewijzigd?

You may try it like this to make the content editable

<div contenteditable><?php echo $content; ?></div>

EDIT :

try this

<div><?php echo htmlspecialchars_decode($content); ?></div>

Just use strip_tags() function :

<textarea ><?php echo strip_tags($content); ?></textarea>

Docs here : http://php.net/manual/fr/function.strip-tags.php

You can do this using js as -- You need two times decoding since as you shown your raw data in db ..

<textarea id='t'></textarea>
<script>
function getHTML(code)
{
var para = document.createElement("DIV");
para.innerHTML=code;
//return $(para).text(); 
 return para.innerText; 
}
document.getElementById('t').innerHTML=getHTML('<?php echo $content; ?>');
</script>

PURE PHP

<textarea id='t'><?php echo html_entity_decode(html_entity_decode($content));?></textarea>

you can do couple of things to figure out

1) use the html_entity_decode function which will decode the html entity which is coming from database and return the html output

2) if the above solution doesn't work then use the first try to echo with html_entity_decode to check that does it work properly or not if it does then there is something we need to do with editor as so that editor will know that it is getting the raw html data not just plain text. i also used the FCKeditor where i have simply put the text and its working fine.