// 添加点赞人 public function addPraisePeople($uid,$demand_id){ $demandId['demand_id'] = $demand_id; $m = D('demand'); $praiseid = $m->where($demandId)->getField('demand_praiseid'); }
One of the demands I posted was that nobody saved me. When I like it, I'm going to take out the Demand_praiseid. This field is converted to an array and the UID is stored in the array and the array is stored in the conversion JSON field.
I haven't done it for a day, and I don't know if I'm trying to make this project too complicated.
Reply content:
// 添加点赞人 public function addPraisePeople($uid,$demand_id){ $demandId['demand_id'] = $demand_id; $m = D('demand'); $praiseid = $m->where($demandId)->getField('demand_praiseid'); }
One of the demands I posted was that nobody saved me. When I like it, I'm going to take out the Demand_praiseid. This field is converted to an array and the UID is stored in the array and the array is stored in the conversion JSON field.
I haven't done it for a day, and I don't know if I'm trying to make this project too complicated.
First of all, to understand your problem, you should ask:
The field of a data table is a varchar type, after you get the value of this field in PHP, how do you convert the value of this field to an array?
Second: If you want to convert the contents of Demand_praiseid to an array, this is going to be based on the structure of your demand_praiseid.
PHP has a function of a string-to-array:
Explode (Separator,string,limit)
Parameter Description: separator: Required. Specifies where to split the string.
String: Required. The string to split.
Limit: Optional. Specifies the number of array elements that are returned. Possible values: greater than 0-returns an array containing a maximum of limit elements less than 0-returns an array containing all elements except the last-limit element 0-Returns an array containing an element
I hope I can help you, but I don't seem to understand your needs.