当我调用一次时,为什么控制器中的动作方法会被执行两次?

时间:2011-01-19 14:06:11

标签: php debugging kohana

在PHP / Kohana应用程序中,当我在浏览器中键入特定路径并按一次时,例如:

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动作中]

为什么这段代码被执行两次,如何在此时找出调用堆栈,即第二次调用此方法是什么?

附录:

@ o1iver,这是整个控制器:

<?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__);
    }
}

0 个答案:

没有答案