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

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -