自定义library 参数传递错误,请大家帮忙
自定义了一个libraryapplication/library/myReadFilter
它是一个第三类的接口实现:代码如下
class MyReadFilter implements PHPExcel_Reader_IReadFilter
{
private $_startRow = 0;
private $_endRow = 0;
private $_columns = array();
/**Get the list of rows and columns to read*/
public function __construct($startRow, $endRow, $columns)
{
$this->_startRow = $startRow;
$this->_endRow = $endRow;
$this->_columns = $columns;
}
public function readCell($column, $row, $worksheetName = '')
{ //Only read the rows and columns that were configured
if ($row >= $this->_startRow && $row <= $_endRow) {
if (in_array($column, $this->_columns)) {
return true;
}
}
return false;
}
}
我在控制器函数中:
//导入library
$this->load->library('myReadFilter');
// 生成对象
$filterSubset = new MyReadFilter(1,2,range('A', 'B'));
错误:
A PHP Error was encounteredSeverity: Warning
Message: Missing argument 1 for MyReadFilter::__construct(), called in D:\xampp\htdocs\chanpin\system\core\Loader.php on line 1099 and defined
Filename: libraries/myReadFilter.php
Line Number: 10
A PHP Error was encounteredSeverity: Warning
Message: Missing argument 2 for MyReadFilter::__construct(), called in D:\xampp\htdocs\chanpin\system\core\Loader.php on line 1099 and defined
Filename: libraries/myReadFilter.php
Line Number: 10
A PHP Error was encounteredSeverity: Warning
Message: Missing argument 3 for MyReadFilter::__construct(), called in D:\xampp\htdocs\chanpin\system\core\Loader.php on line 1099 and defined
Filename: libraries/myReadFilter.php
Line Number: 10
A PHP Error was encounteredSeverity: Notice
Message: Undefined variable: startRow
Filename: libraries/myReadFilter.php
Line Number: 12
A PHP Error was encounteredSeverity: Notice
Message: Undefined variable: endRow
Filename: libraries/myReadFilter.php
Line Number: 13
A PHP Error was encounteredSeverity: Notice
Message: Undefined variable: columns
Filename: libraries/myReadFilter.php
Line Number: 14
请参考 upload的使用方法:
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width']= '1024';
$config['max_height']= '768';
$this->load->library('upload', $config);
希望对你有帮助 :) Ahgigu 发表于 2014-5-14 17:19
请参考 upload的使用方法:
非常感谢,我去试试
页:
[1]