"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 }