json - Accessing POST data from controller in CakePHP -
if json data being post-ed , sent controller.
{ "email" : "xyz@something.com" , "password" : "mypassword" }
and want access email , password , assign them separate variables in controller function login ()
how go it?
should ?
public function login( ) { $temp=$this->request->email ; $foo=$this->request->password; }
please let me know how can . thanks
you need json object , decode it. if json object called $jsonobject
, decoding $data = json_decode($jsonobject, true); $temp= $data['email']; $foo= data['password'];
Comments
Post a Comment