2017-02-10 6 views
1

私は、anglejsを使ってmysqlからckeditorフィールドにデータを表示したいと思っています。しかし、唯一の問題は配列も表示されていることです(can refer here)anglejs PHPを使用してmysqlからckeditorフィールドにデータを表示する方法は?

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

どうすればいいですか?読んでくれてありがとう。

答えて

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

お返事ありがとうございます。それでも同じです – zyod

関連する問題