enter image description here codeigniterとangularjsを使用してmysql dbからテーブルを表示しようとしています。このメッセージの修正方法重大度:通知 - >未定義のプロパティ:stdClass ::
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<title>List Show Data</title>
<link rel="stylesheet" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div ng-controller="decontroller">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Role</th>
<th>Privileges</th>
<th>User Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="n in list_data">
<td>{{n.First Name}}</td>
<td>{{n.Last Name}}</td>
<td>{{n.Email}}</td>
<td>{{n.Role}}</td>
<td>{{n.Privileges}}</td>
<td>{{n.User Name}}</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript" href="/public/js/angular.js"> </script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"> </script>
<script type="text/javascript">
var app = angular.module('app',[]);
app.controller('decontroller', function($scope,$http){
$scope.list_data=[];
$http.get("ajax_load_data").success(function(result){
$scope.list_data=result;
});
});
</script>
</body>
</html>
この私のコントローラlist_show_data.php: これが私の見解である
Severity: Notice --> Undefined property: stdClass::$First C:\xampp\htdocs\stlc\application\controllers\MainTest.php 38
ERROR - 2016-09-22 16:31:19 --> Severity: Notice --> Undefined property: stdClass::$Last C:\xampp\htdocs\stlc\application\controllers\MainTest.php 39
ERROR - 2016-09-22 16:31:19 --> Severity: Notice --> Undefined property: stdClass::$User C:\xampp\htdocs\stlc\application\controllers\MainTest.php 43
stlc_usersテーブルを確認すると、おそらく列が間違っている可能性があります。 'var_dump($ r)'は – aynber
も明らかにこれを助けます: '$ data_arr [$ i] ['名]' = $ r->最初です。 '$ r'にあるものをチェックするような、基本的なデバッグを行いましたか? –
@MarcB、 '$ r'は' foreach($ res as $ r) 'によって提供されている現在の値です – DFriend