這裏是我的config/upload.php的代碼:
if($this->uri->segment(2)=='addPlace'){
$config[upload_path] = './uploads/place_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
elseif($this->uri->segment(2)=='addPack'){
$config[upload_path] = './uploads/package_pic/';
$config[allowed_types] = 'gif|jpeg|jpg|png';
}
運行我的項目,它顯示了在:
A PHP Error was encountered
嚴重性:注意
消息:未定義的屬性:CI_Loader :: $ uri
文件名:config/upload.php
行號:2
回溯:
文件:d:\ XAMPP \ htdocs中\ project_tour_city \程序\ CONFIG \ upload.php的 行:2 功能:_error_handler
在助手添加此代碼,並定義'$ CI =&get_instance();'然後調用'$ CI- > URI->段(2)'。 – Gaurav