日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

angularjs与后台传值接收值

發(fā)布時(shí)間:2025/5/22 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 angularjs与后台传值接收值 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

有問題加我qq1374394031

<html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> <style> table, th , td {border: 1px solid grey;border-collapse: collapse;padding: 5px; } table tr:nth-child(odd) {background-color: #f1f1f1; } table tr:nth-child(even) {background-color: #ffffff; } </style> </head> <body><div ng-app="myApp" ng-controller="customersCtrl"><table><tr ng-repeat="x in names"><td>{{ x.name }}</td><td>{{ x.sex }}</td><td>{{ x.age }}</td></tr> </table></div><script> var app = angular.module('myApp', []); app.controller('customersCtrl', function($scope, $http) {$http({url: 'data.php',method: 'post',data:{id:'1','a':5}}).success(function (data) {$scope.names = data;}); }); </script></body> </html>

data.php

<?php$a = json_decode(file_get_contents("php://input")); // 因?yàn)閭鞯闹凳莏son格式 先進(jìn)行轉(zhuǎn)化if($a->id==1){$arr=['0'=>['name'=>'畢世杰','sex'=>'男','age'=>'19'],'1'=>['name'=>'黃成志','sex'=>'男','age'=>'20'],'2'=>['name'=>'王闖','sex'=>'男','age'=>'19'],'3'=>['name'=>'李關(guān)亮','sex'=>'男','age'=>'19']];}else{$arr=['0'=>['name'=>'哈哈','sex'=>'男','age'=>'19']];}echo $arr=json_encode($arr); >

總結(jié)

以上是生活随笔為你收集整理的angularjs与后台传值接收值的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。