为什么这赢得了工作? I 用户已经安装,希望其他有相同标签的用户获得。
主计长:
$this->load->model( tag_model );
$data[ usr_tags ] = $this->tag_model->get_home_tags($user_id);
$tags = $this->tag_model->get_home_tags($user_id);
$tag_array = $tags;
$data[ tag_users ] = $this->tag_model->get_tag_users($tag_array);
模式:
function get_tag_users($tag_array)
{
//$tag = array( item1 , item2 , item3 );
$tag = $tag_array;
$query_str = SELECT DISTINCT user_id FROM tags WHERE tag IN (" . implode( "," , $tag) . ") ;
$query = $this->db->query($query_str);
if($query->num_rows() > 0) {
foreach($query->result_array() as $tag_users) {
$data[] = $tag_users;
}
return $data;
}else{
return false;
}
}
错误:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: models/tag_model.php
Line Number: 20