我插入的数据库文本,我写使用编辑器.然后,我怎么能得到这个文本没有html标签


Im Inserting on database text that I write using tinymce editor. Then, how can I get this text without html tags?

我在表新闻中插入了一些信息:标题和内容。

标题工作得很好,但对于内容,我使用timymce编辑器来编写我的内容,当我插入时,我收到我的内容如下:

如果我这样写:我正在做一个测试来告诉你我得到了什么。

我得到这个: <p>Im doing a test to show you what Im getting.</p>

你知道,我们如何得到的文本,我们写使用定时器编辑器,没有html标签??

我已经尝试使用htmlspecialchars(),但没有成功。

这是我的php,我在这里插入:

<?php
if(isset($_POST['sendForm'])){
    $f['title'] = $_POST['title'];
    $f['conteudo'] = $_POST['content'];
    if(in_array('',$f))
    {
        echo 'You need to fill all';
    }
    else
    {
        $insert = $pdo->prepare("INSERT INTO news ( title, content) VALUES (:title, :content)");  
        $insert->bindValue(':title', $f['title']);
        $insert->bindValue(':content', $f['content']);
        $insert->execute();
    }
}
?>

然后我有我的表单,我的文本区有class="tinymce"因为我在这里使用这个插件:

<form  action="" method="post" enctype="multipart/form-data">
<label class="line">
    <span>title:</span>
    <input type="text" name="title" value="<?php if(isset($_POST['title'])) echo $f['title']; ?>" />
</label>
<label class="line">
    <span>Content:</span>
    <textarea name="content" class="tinymce" rows="15"><?php if(isset($_POST['content'])) echo htmlspecialchars($f['content']); ?></textarea>
</label>
<input type="submit" value="Send" name="sendForm"/>
</form>

这是因为我想使用jQuery自动完成,我想在自动完成中显示新闻的标题和内容。

但是因为我有我的内容保存在数据库与html标签,当我开始写,我的自动完成结果出现如下:

Title -;& gt;<内容,ccedil;;>

这是我的php自动完成:
switch($action)
{
    case 'complete':
      $search = isset($_GET['term']) ? $_GET['term'] : "";
       $pdo = conecting();
       $read = $pdo->prepare("SELECT * from news WHERE title LIKE ?");   
       $read->bindValue(1, "%$search%", PDO::PARAM_STR);
       $read->execute();
       $data = array();
        while($res = $read->fetch(PDO::FETCH_ASSOC))
        {
          $data[] = $res['title'].'-'.$res['content'];
        }
        echo json_encode($data);
    break;
}

您要找的是strip_tags()