-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