Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ng2发布时,$\u php[';creds';]为空_Php_Rest_Angular - Fatal编程技术网

使用ng2发布时,$\u php[';creds';]为空

使用ng2发布时,$\u php[';creds';]为空,php,rest,angular,Php,Rest,Angular,对于ng2 restful Web服务,$\u post['creds']为空: let creds = "email=" + userDetails.email + "&password=" + userDetails.password; let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' }); let options = new RequestOptions

对于ng2 restful Web服务,
$\u post['creds']
为空:

let creds  = "email=" + userDetails.email + "&password=" + userDetails.password;
    let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
    let options = new RequestOptions({ headers: headers });
     this.http.post("http://www.dr-gontar.com/checkSignIn/", creds, options)
        .subscribe((data:Response) => this.id = JSON.parse(data.text()).id);

this.http.post("http://www.dr-gontar.com/checkSignIn/", creds, options )
    .subscribe((data:Response) => this.email = JSON.parse(data.text()).email);

this.http.post("http://www.dr-gontar.com/checkSignIn/", creds, options )
    .subscribe((data:Response) => this.name = JSON.parse(data.text()).name);

this.http.post("http://www.dr-gontar.com/checkSignIn/", creds, options)
    .subscribe((data:Response) => this.mobile = JSON.parse(data.text()).mobile);

this.http.post("http://www.dr-gontar.com/checkSignIn/", creds, options )
    .subscribe((data:Response) => this.address = JSON.parse(data.text()).address);

this.userDetails = [this.id,this.email,this.name,this.mobile,this.address];
console.log(this.userDetails);
使用:

然后,您可以像这样接收电子邮件:

$_POST['email']

这段代码并不完整,只是一个甚至不做任何事情的方法。如果需要帮助,请编辑并添加完整的代码示例…this.http.post(“),creds,options).subscribe((data:Response)=>this.id=JSON.parse(data.text()).id);我不知道Angular2的情况,但在Angular2中,您可以阅读带有
文件获取内容的$\u帖子(“php://input");请不要编辑我的答案以添加其他信息;)那么,您是否只尝试检查值是否在后端接收?…这意味着您在检查值是否确实存在之前,不会尝试对这些值执行任何操作?:)对不起,请撤消编辑。有一个小小的进步,但有些奇怪。它无法执行访问控制允许源代码,尽管我是这样编写的:header(“访问控制允许源代码:”);这是一个错误:让我们。
$_POST['email']