简体   繁体   English

如何使用angularjs php将mysql中的数据显示到ckeditor字段中?

[英]How to display data from mysql into ckeditor field using angularjs php?

I want to display data from mysql into ckeditor field using angularjs, it works.我想使用 angularjs 将来自 mysql 的数据显示到 ckeditor 字段中,它可以工作。 But the only problem is the array also displayed (can refer here)但唯一的问题是数组也显示出来(可以参考这里)

Array ( [0] => Array ( [qterm] =>This paragraph only.) ) 

here is my coding.这是我的编码。

index.html索引.html

<textarea name="editor1" class="ckeditor" id="editor1" ng-model="tnc"></textarea>

myApp.js我的应用程序

var app=angular.module('myApp',[]);
app.controller('cntrl', function($scope,$http) {

    function getTerm() {
        $http.get("qterm.php").success(function(data) {
            $scope.tnc = data;
        });
    };
    getTerm();
});

qterm.php qterm.php

<?php
include('../config.php');
$query="select qterm from configuration";
$data = array();
$rs=$connect->query($query);

while ($result = mysqli_fetch_assoc($rs)) {
    $data[] = $result;
}

print_r($data);
//print json_encode($data);
?>

What should I do?我该怎么办? Thanks for reading.谢谢阅读。

$output = print_r($data, true);
echo $output;

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

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