我得到如下所述的输出我需要将这些std类对象转换为数组
输出值
stdClass Object
(
[PRODUCT_CODE] => PRD000001
)
stdClass Object
(
[PRODUCT_CODE] => PRD000003
)
所需输出
$data = array('PRD000001','PRD000003');
我使用下面的代码如何实现所需的格式
$this->db->select('PRODUCT_CODE');
$this->db->from('NT_PATIENT_MEDICINE_LOG');
$this->db->where_in('PATIENT_CODE',$patient_code);
$query = $this->db->get();
if ($query->num_rows() >= 1) {
$result = $query->result_array();
foreach($result as $key => $value):
$data = array();
$data[] = $value[$key]['PRODUCT_CODE'];
echo "<pre>";print_r($data);
endforeach;
}