Php 为什么控制器中的动作方法在我调用一次时会执行两次?
在PHP/Kohana应用程序中,当我在浏览器中键入特定路线并按enter键一次时,例如:Php 为什么控制器中的动作方法在我调用一次时会执行两次?,php,debugging,kohana,Php,Debugging,Kohana,在PHP/Kohana应用程序中,当我在浏览器中键入特定路线并按enter键一次时,例如: http://localhost/test/importmanager/import_csv 该特定控制器操作方法中的代码执行两次: public function action_import_csv() { helpers::debug('in import csv action', __FILE__, __LINE__); } 输出: 2011-01-19 14:58:14:/data/d
http://localhost/test/importmanager/import_csv
该特定控制器操作方法中的代码执行两次:
public function action_import_csv()
{
helpers::debug('in import csv action', __FILE__, __LINE__);
}
输出:
2011-01-19 14:58:14:/data/domains/test/importmanager.php,第27行:[导入csv操作中]
2011-01-19 14:58:14:/data/domains/test/importmanager.php,第27行:[导入csv操作中]
为什么这段代码要执行两次,我如何才能找到此时的调用堆栈,即第二次调用这个方法是什么?
增编:
@不过,这是整个控制器:
<?php
class Controller_Backend_Application_Importmanager extends Backend_Controller
{
public function action_index()
{
$view = new View('backend/application/importmanager');
$smart_worksheets = array();
$raw_files = glob('/data/original_excel/*.*');
if (count($raw_files) > 0)
{
foreach ($raw_files as $raw_file)
{
$smart_import_file = new Backend_Application_Smartimportfile($raw_file);
$smart_worksheets = $smart_import_file->add_smart_worksheets_to($smart_worksheets);
}
}
$view->set('smart_worksheets', $smart_worksheets);
$this->request->response = $view;
}
public function action_import_csv()
{
debug_print_backtrace();
echo '----------------------------------------------------------------';
helpers::debug('in import csv action', __FILE__, __LINE__);
//helpers::showCallStack();
}
public function action_import_excel()
{
helpers::debug('in import excel action', __FILE__, __LINE__);
}
}
使用debug\u print\u backtrace()
并查看。谢谢,这使我看到bootstrap.php文件执行了两次请求,一次正常,一次用于phpunit,解决方案是取出第二个。我对FireBug和Zend登录到其控制台的能力有类似的问题。我知道你不使用Zend,但要记住一些东西——也许。