Php 从数据库将文本插入纬管

Php 从数据库将文本插入纬管,php,sql,quill,Php,Sql,Quill,我将文本存储在数据库中,希望允许用户对其进行编辑。我想从数据库中检索文本并将其插入到Quill编辑器中,以便用户可以更改它,然后重新加载它。 如何从数据库中检索数据并将其插入羽毛笔编辑器 这是我从数据库获取数据的方式 if(isset($_GET['articleId'])){ $username = noHTML($_SESSION['username']); $articleId = noHTML($_GET['articleId']); $sqlbefore = $

我将文本存储在数据库中,希望允许用户对其进行编辑。我想从数据库中检索文本并将其插入到Quill编辑器中,以便用户可以更改它,然后重新加载它。 如何从数据库中检索数据并将其插入羽毛笔编辑器

这是我从数据库获取数据的方式

if(isset($_GET['articleId'])){
    $username = noHTML($_SESSION['username']);
    $articleId = noHTML($_GET['articleId']);
    $sqlbefore = $db->prepare('SELECT `username`, `title`, `description`, `text` FROM articles WHERE username = ? AND artId = ?');
    $sqlbefore->bind_param('si', $username, $articleId);
    $sqlbefore->execute();
    $result = $sqlbefore->get_result();
    $row = $result->fetch_assoc();
    if($username != $row['username']){
        header("location:index.php");
    }

    $titleValue = $row['title'];
    $descriptionValue = $row['description'];
    $textValue = $row['text'];

}
然后我使用textValue变量将其放入一个带有display none的隐藏div中,然后将文本设置到quill编辑器中

var quill = new Quill('#editor', {
        modules: { toolbar: toolbarOptions },
        theme: 'snow'
    });
    var text = $('#hidden_text').html();
    quill.setText(text);
编辑器将显示以下字符串:

<p>Normal text</p><h1>Header Text</h1>
普通文本

标题文本
而不是像标签描述的那样显示它


如何设置文本,使其显示为HTML标记描述的文本?

这确实有效,但当然,我仍然使用隐藏的div将数据从PHP传递到jQuery。如果任何人在安全性或编码方面有任何可能的改进,请发表评论

var quill = new Quill('#editor', {
        modules: { toolbar: toolbarOptions },
        theme: 'snow'
    });
    var text = $('#hidden_text').html();
    quill.clipboard.dangerouslyPasteHTML(0,text);