我的代码是
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->database();
$this->load->model('Admin_model');
$this->load->helper(array('form','file','url','security'));
}
public function update()
{
if ($_POST){
$this->config = array(
'upload_path' => dirname($_SERVER["SCRIPT_FILENAME"])."/logo/",
'upload_url' => base_url()."logo/",
'allowed_types' => "gif|jpg|png|jpeg",
'overwrite' => TRUE,
'max_size' => "1000KB",
'max_height' => "768",
'max_width' => "1024"
);
$this->load->library('upload', $this->config);
if(!$this->upload->do_upload('logo'))
{
echo $this->upload->display_errors();
}
else
{
$finfo=$this->upload->data();
$this->_createThumbnail($finfo['file_name']);
$data['uploadInfo'] = $finfo;
$data['thumbnail_name'] = $finfo['raw_name']. '_thumb' .$finfo['file_ext'];
print_r($finfo);
}
}
}
public function _createThumbnail($filename)
{
$config['image_library'] = "gd2";
$config['source_image'] = "logo/" .$filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = "80";
$config['height'] = "80";
$this->load->library('image_lib',$config);
if(!$this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}
}
}
我已经加载了所有库,但它没有工作返回错误
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: core/Loader.php
Line Number: 1213
Backtrace:
File: /var/www/html/relatio/application/admin/controllers/Admin.php
Line: 90
Function: library
File: /var/www/html/relatio/admin/index.php
Line: 293
Function: require_once
Fatal error: Call to a member function site_url() on a non-object in /var/www/html/relatio/system/helpers/url_helper.php on line 66
A PHP Error was encountered
Severity: Error
Message: Call to a member function site_url() on a non-object
Filename: helpers/url_helper.php
Line Number: 66
Backtrace:
接下来我该怎么办?建议请