簡體   English   中英

如何使用angularjs php將mysql中的數據顯示到ckeditor字段中?

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

我想使用 angularjs 將來自 mysql 的數據顯示到 ckeditor 字段中,它可以工作。 但唯一的問題是數組也顯示出來(可以參考這里)

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

這是我的編碼。

索引.html

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

我的應用程序

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

我該怎么辦? 謝謝閱讀。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM