0

如何在 PHP 中从此对象获取电子邮件变量?

$data = $_POST["data"];

内容$data

Object {email: "peter.m@gmail.com"} 
4

2 回答 2

2

也许它是一个json字符串?尝试:

$data = json_decode($data);
$email = $data->email;
于 2013-05-28T18:44:51.203 回答
0

这应该工作”

$email_string = $data->email;  //should work

//    or

$email_string = $data['email'];   //might also work
于 2013-05-28T18:35:58.533 回答