Php 如何存储值

Php 如何存储值,php,laravel-5.1,Php,Laravel 5.1,我为每个id构造一个不同的值,这是我的代码 $errorMessage = array(); $result = CheckpointErrormsg::where('checklist_template_id', $checklist_template_id) ->orderby('error_message', 'asc') ->select('checkpoint_id', 'error_message')

我为每个id构造一个不同的值,这是我的代码

$errorMessage = array();
   $result = CheckpointErrormsg::where('checklist_template_id', $checklist_template_id)
             ->orderby('error_message', 'asc')
             ->select('checkpoint_id', 'error_message')
             ->get()->toArray();

   foreach ($result as $row) {
        $errorMessage[$row['checkpoint_id']][] = $row['error_message'];
   }
   return $errorMessage;    
}
这是我的刀片视图页面:

 {!! Form::select($checkpoint['id'].'_c[]', isset($error_messages[$checkpoint['id']])?$error_messages[$checkpoint['id']] : array(), $explode_values, array('multiple'=>'true', 'class'=>'form-control js-example-tags select2','id'=>$checkpoint['id'].'_c')) !!}
在我的数据库中插入了以下格式:值0,1,2,但我需要红色、蓝色和绿色
请帮助我

打印($errorMessage)上的输出是什么?这是我的输出阵列(大小=2)“6e8a7bfc9b664ef3ad9812b7605e2304”=>阵列(大小=3)0=>字符串“1111”(长度=4)1=>字符串“2222”(长度=4)2=>字符串“3333”(长度=4)“b551b723eb864a318c0a4a8fc3da6ba6”=>数组(大小=4)0=>字符串“蓝色”(长度=4)1=>字符串“绿色”(长度=5)2=>string'red'(长度=3)3=>string'yellow'(长度=6)返回在
print\r($errorMessage)上输出的数组值?这是我的输出阵列(大小=2)“6e8a7bfc9b664ef3ad9812b7605e2304”=>阵列(大小=3)0=>字符串“1111”(长度=4)1=>字符串“2222”(长度=4)2=>字符串“3333”(长度=4)“b551b723eb864a318c0a4a8fc3da6ba6”=>数组(大小=4)0=>字符串“蓝色”(长度=4)1=>字符串“绿色”(长度=5)2=>字符串“红色”(长度=3)3=>字符串“黄色”(长度=6)返回数组值