我有上传图片的方法,但如果我运行此方法并出现错误,我会收到多条错误消息:
严重性:警告
消息:pathinfo()期望参数1为字符串,给定数组为
文件名:core / Loader.php
行号:759
严重性:注意
消息:数组到字符串转换
文件名:core / Loader.php
行号:760
遇到错误
无法加载请求的文件:Array.php
如何修复代码以免出错?问题出在哪儿 ? 谢谢
function upload_image()
{
$config = array(
'file_name'=> 'hallo.jpg',
'upload_path'=>'./application/views/photo',
'allowed_types'=>'gif|jpg|png',
'max_size'=>'1024',
'max_width'=>'1600',
'max_height'=>'1200'
);
$this->load->library('upload', $config);
if($this->upload->do_upload())
{
$data['breadcrumb1'] = "Member";
$data['breadcrumb'] = "Add Member";
$data['content']='admin-cms/member/add';
$this->load->view('admin-cms/index', $data);
}else
{
$data['content']= array('error' => $this->upload->display_errors('<span class="error">','</span>'));
$this->load->view('admin-cms/index', $data);
}
}