Arrays 在codeigniter中,如何将数组传递给函数参数
作为标题,我有一个库函数Arrays 在codeigniter中,如何将数组传递给函数参数,arrays,codeigniter,parameters,Arrays,Codeigniter,Parameters,作为标题,我有一个库函数$this->foo->bar()。如何将$upload\u data数组传递到$this->foo->bar()param 我的控制器里有这个 $upload_data = $this->upload->data(); //$upload_data['file_name'] $this->foo->bar($upload_data); 我的图书馆里有这个 public function bar($arr){ $config['sourc
$this->foo->bar()
。如何将$upload\u data
数组传递到$this->foo->bar()
param
我的控制器里有这个
$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
}
我犯了这个错误
消息:非法字符串偏移量“文件名”
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)并让我们知道result@mallix添加在问题中如果您在bar函数中得到相同的结果,它应该会工作。@mallix我的错误,问题来自另一个函数这是一个答案,我想这需要一个注释:)