错误“函数的参数太少"; [英] Error "Too few arguments to function"
问题描述
我在以下代码段中出错:函数showtbl :: GetTabellen_ns()的参数太少,第153行的abcde/folder/php.php中传递了0,而恰好是2个期望
I got an error in the following code piece: Too few arguments to function showtbl::GetTabellen_ns(), 0 passed in abcde/folder/php.php on line 153 and exactly 2 expected
不知道我为什么得到这个.我对PHP Prado和所有编程语言都是新手,所以也许是一个愚蠢的错误.
Don't know why I get this. I'm quite new to PHP Prado and in all programming so maybe a stupid mistake.
protected function GetTabellen_ns($offset, $limit)
{
$criteria=new TActiveRecordCriteria;
$criteria->Condition = 'name = $name';
$criteria->OrdersBy['name'] = 'asc';
$criteria->Limit = 15;
$criteria->Offset = 20;
return prdtblRecord::finder()->findAll($criteria);
}
protected function populateData_ns($offset, $limit)
{
$offset=$this->Repeater->CurrentPageIndex*$this->Repeater->PageSize;
$limit=$this->Repeater->PageSize;
if($offset+$limit>$this->Repeater->VirtualItemCount) {
$limit=$this->Repeater->VirtualItemCount-$offset;
}
$this->Repeater->DataSource=$this->GetTabellen_ns($offset,$limit);
$this->Repeater->dataBind();
}
寻求帮助,希望有人能帮助我.
Thx for help hope someone can help me.
如果有人可以告诉我$ offset和$ limit的设置也将对我有很大帮助.
edit: If someone can tell me how $offset and $limit get set would help me alot too.
推荐答案
您可以这样调用函数: $ this-> GetTabellen_ns()
You call the function like this:
$this->GetTabellen_ns()
但是函数需要两个参数( offset
和 limit
).
But function needs two arguments (offset
and limit
).
如果要将这些参数设置为可选参数,则可以给它们一个默认值,如下所示:
If you want to set these argument as optional argument, you can give them a default value like this:
protected function GetTabellen_ns($offset = 0, $limit = 0){
.
.
.
}
这篇关于错误“函数的参数太少";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!