"data": { "id": 9, "name": "tala", "role": "Student", "email": "tala@gmail.com", "students": [ { "id": 1, "name": "tala", "type": "Master_Degree", "year": "third", "Semester": null, "specializations": "جراحة", } ] },
我曾經透過這樣做來接收電子郵件:
回應['資料']['電子郵件']
如何從回應['data']['student']中取得「類型」? ?
P粉3110892792024-04-05 12:10:16
在您的data
物件中,學生是一個物件陣列!
可以增加這麼多學生!
要存取學生屬性,您必須循環到學生陣列中。
$students = response["data"]["students"]; foreach($students as $student ) { //access to each student in your list // do what ever you want }