逝去的青春
PHP变量中的变量,代码片段
2018-10-28 jao





$ids=array(1,2,3,4);

$sql_mul = "SELECT * FROM `usertable` WHERE `id` IN (" . implode(',', $ids) . ")";

$query_mul = $this->db->query($sql_mul);

$row_mul = $query_mul->result_array();

foreach ($row_mul as $k => $val) {

$host = $val['host'];

${"row_$host"}[$k] = $val;

//TODO 变量中添加变量,变量中的变量

}

print_r($row_xxx);