作为标题,我有一个库函数$this->foo->bar()
。如何将$upload_data
数组传递给$this->foo->bar()
参数?
我的控制器中有这个
$upload_data = $this->upload->data();
//$upload_data['file_name']
$this->foo->bar($upload_data);
然后我的图书馆里有这个
public function bar($arr){
$config['source_name'] = //How can I use $arr['file_name'] in here
}
我收到此错误消息:非法字符串偏移 'file_name'
var_dump($upload_data)
array (size=14)
'file_name' => string '1358459309.JPG' (length=14)
'file_type' => string 'image/jpeg' (length=10)
'file_path' => string 'C:/wamp/www/foldering/assets/img/uploaded_photos/' (length=49)
'full_path' => string 'C:/wamp/www/foldering/assets/img/uploaded_photos/1358459309.JPG' (length=63)
'raw_name' => string '1358459309' (length=10)
'orig_name' => string '1358459309.JPG' (length=14)
'client_name' => string '200X CNY1.JPG' (length=13)
'file_ext' => string '.JPG' (length=4)
'file_size' => float 30.87
'is_image' => boolean true
'image_width' => int 640
'image_height' => int 480
'image_type' => string 'jpeg' (length=4)
'image_size_str' => string 'width="640" height="480"' (length=24)