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

时间:2017-02-10 12:26:25

标签: php mysql angularjs ckeditor

我想使用angularjs将mysql中的数据显示到ckeditor字段,它可以工作。但唯一的问题是数组也显示(can refer here)

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

这是我的编码。

的index.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

<?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);
?>

我该怎么办?谢谢你的阅读。

1 个答案:

答案 0 :(得分:1)

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