-1
作为标题,我有一个库函数$this->foo->bar()
。我怎样才能将$upload_data
数组传递给$this->foo->bar()
param?在codeigniter中,如何将数组传递给函数参数
我有这个在我的控制器
$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)
你可以请var_dump($ upload_data)让我们知道结果 – mallix
@mallix问题 – vzhen
添加如果你在条形函数内得到相同的结果,它应该工作。 – mallix