将角度服务中的值传递给php文件

时间:2016-10-28 17:33:47

标签: php angularjs

我正在尝试将参数从我的角度服务传递到PHP文件

function SearchStudent(studentId) {
    return $http.get('app-data/search-student.php',
        {params: { studentId:  studentId }})
          .then(function(response) {
          return response.data;
  });
}

然后我尝试用我的php文件中的_GET检索该值

$studentId = $_GET['studentId'] . "%";

问题不仅仅是获取ID {“studentId”:“######”}

1 个答案:

答案 0 :(得分:0)

您的SearchStudent函数已在{"studentId":"######"}参数中收到studentId,因此您将{ studentId: {studentId: '######' }}发送到您的PHP文件。