我希望在加载(client/results)
视图时运行我的第二个函数(插入函数)。
所以当getResults在触发器中我希望也运行create function。
private function getResults()
{
$data['emailcount'] = $score = $this->actions->getEmailCount();
$data['sentEmailCount'] = $score = $this->actions->getSentEmailCount();
$data['score'] = $score = $this->actions->getScore();
$data['percentile'] = $percentile = $this->actions->getPercentile($score);
$data['timespent'] = $this->input->get('time');
// echo $this->input->get('time');
return $this->load->view('client/results', $data);
}
function create()
{
$adddata = array(
'uniID' => '5',
'testName' => 'Abintegro E-Tray test',
'testID' => '99999',
'total' => '20',
'userID' => '00000',
'useInPercentile' => '1',
'correct' => $score = $this->actions->getScore(),
'percent' => $score = $this->actions->getScore(),
'percentile' => $percentile = $this->actions->getPercentile($score),
'dateTaken' => date('Y-m-d H:i:s'),
// 'timeSpent' => $this->input->get('time')
);
$this->actions->add_record($adddata);
$this->index();
}
我尝试了什么
private function getResults()
{
$data['emailcount'] = $score = $this->actions->getEmailCount();
$data['sentEmailCount'] = $score = $this->actions->getSentEmailCount();
$data['score'] = $score = $this->actions->getScore();
$data['percentile'] = $percentile = $this->actions->getPercentile($score);
$data['timespent'] = $this->input->get('time');
// echo $this->input->get('time');
$this->create();
return $this->load->view('client/results', $data);
}
但这会产生错误
致命错误:' 256'的最大功能嵌套级别到达,流产!在第2507行的C:\ wamp64 \ www \ New \ system \ database \ DB_query_builder.php
并尝试了
private function getResults()
{
{
$data['emailcount'] = $score = $this->actions->getEmailCount();
$data['sentEmailCount'] = $score = $this->actions->getSentEmailCount();
$data['score'] = $score = $this->actions->getScore();
$data['percentile'] = $percentile = $this->actions->getPercentile($score);
$data['timespent'] = $this->input->get('time');
// echo $this->input->get('time');
$this->create();
return $this->load->view('client/results', $data);
};
$this->actions->add_record($adddata);
$this->index();
}
答案 0 :(得分:1)
你有一个无限循环的2个函数无限期地相互调用(可能不是直接)。
在getResults()
致电$this->create();
检查create()
中的任何getResults()
调用是否最终都在HttpConfiguration config = new HttpConfiguration();
new MobileAppConfiguration()
.UseDefaultConfiguration()
.ApplyTo(config);
中,如果是,则创建一个递归循环。
答案 1 :(得分:0)
private function getResults()
{
{
$data['emailcount'] = $score = $this->actions->getEmailCount();
$data['sentEmailCount'] = $score = $this->actions->getSentEmailCount();
$data['score'] = $score = $this->actions->getScore();
$data['percentile'] = $percentile = $this->actions->getPercentile($score);
$data['timespent'] = $this->input->get('time');
// echo $this->input->get('time');
};
$adddata = array(
'uniID' => '5',
'testName' => 'Abintegro E-Tray test',
'testID' => '99999',
'total' => '20',
'userID' => '00000',
'useInPercentile' => '1',
'correct' => $score = $this->actions->getScore(),
'percent' => $score = $this->actions->getScore(),
'percentile' => $percentile = $this->actions->getPercentile($score),
'dateTaken' => date('Y-m-d H:i:s'),
// 'timeSpent' => $this->input->get('time')
);
$this->actions->add_record($adddata);
// $this->index();
return $this->load->view('client/results', $data);
}