我正在Cakephp 2.x上工作...我想返回一个响应到我的android应用程序与jom中的索姆数据..我的功能,我是如何让我在CakePHP的网络响应..如何返回json响应我的android应用程序Cakephp
public function phone(){
$this->loadModel('User');
if ($this->request->isPost()){
$json = $this->request->data('json');
$data = json_decode($json, TRUE);
if($data){
//here i want to send response back to mobile app
}
}
我想在我的JSON响应这样的返回..我的意思是我想在一个JSON响应发送变量的名称和它的值
[Contact] => Array
(
[idContacts] => 1
[name] => asad
[mobileNo] => 03224999464
为什么不使用JsonView作为记录? http://mark.cakephp.org/2.0/en/views/json-and-xml-views.html – mark
@mark不知道如何使用它们 – hellosheikh
这里有很好的描述。对不起,但在看到你问了很多像这样的问题之后,看起来你真的不想读*,而是想让其他人为你的工作做好准备,你可以复制和粘贴你的代码。如果您在编写完善的文档时遇到问题,则可能需要在继续编程之前解决该问题,因为使用文档是编程的重要部分。 – burzum