I'm kinda struggling with yii framework. I would like to connect to mobile app from my php server. How should I do the Json encoding and sent to mobile app in yii framework?
|
Q: How should I do the Json encoding and sent to mobile app in yii framework?A:
Q: If I want to pass in just user_name to mobile app, is it possible? How should I do that?A:
//echo json as written at answer #1 Good luck! |
|||
|
The Yii way to do it is
The underlying code use json_encode, but there are advantages discussed here : Why use CJSON encode when we have json_encode |
|||
|
Im using this:
this does work when i test: localhost/myproject/index.php/user/getuser/user_id Is it possible for json to just encode just one attribute and send to mobile app? Example: there are the attributes like: user_id, user_name, user_email, user_photo If I want to pass in just user_name to mobile app, is it possible? How should I do that? |
||||
|