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?
Answer
A:
echo CJSON::encode($myArray);
A:
$criteria=new CDbCriteria;
$criteria->select='user_name'; // only select the 'user_name' column
$criteria->condition='user_id=:user_id';
$user_id = filter_input(INPUT_GET,'user_id');
if(FALSE===$user_id){
header($_SERVER['SERVER_PROTOCOL'].' 404 not found');
return false;
}
$criteria->params=array(':user_id'=>$user_id); // check
$user=Users::model()->find($criteria); // $params is not needed
//echo json as written at answer #1
Good luck!
No comments:
Post a Comment