【发布时间】:2017-09-06 09:28:00
【问题描述】:
这是我的 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\application\config\upload.php 线路:2 函数:_error_handler
【问题讨论】:
-
在助手中添加这段代码并定义
$CI = &get_instance();然后调用$CI->uri->segment(2)。
标签: codeigniter upload