dougou8552 2013-05-03 23:01
浏览 29

在Codeigniter控制器中多次调用的函数

I have this code in my CI controller.

public function edit($id = '') 
{

    $this->load->helper("form");
    $this->load->library("form_validation");
    $data["title"] = "Edit category";

    $this->form_validation->set_rules('category_name', 'Category name', 'required');

    if (!$this->form_validation->run())
    {
        $data['category'] = $this->categories_model->get_categories($id);
        $this->load->view("templates/admin_header", $data);
        $this->load->view("categories/edit", $data);
        $this->load->view("templates/admin_footer", $data); 
    }
    else
    {
        $this->categories_model->update($id);
        // other logic
    }
}

If the form is submited, it updates the category. If I load the page /categories/edit/32 it shows me the info for the category.

I develop with Netbeans and XDebug. My problem here is that when I put a break point on the first line of the function, the debugger returns three times on the break point. I load the page /categories/edit/32 and the debugger stops at the first line om the break point. I press F5 to continue, it loads the function for the second time. I press F5 again, it loads the function for the third and last time. What can cause this? Is this some bug in Netbeans or XDebug, or I have some bug that I can't see?

EDIT:

I have this .htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|include|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

I've found that the problem is in one jQuery plugin that preloads all the images from all the css files. All the images that are preloaded are inside the images folder. If I remove the plugin, it works fine.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 potsgresql15备份问题
    • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
    • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
    • ¥60 pb数据库修改与连接
    • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
    • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
    • ¥20 神经网络Sequential name=sequential, built=False
    • ¥16 Qphython 用xlrd读取excel报错
    • ¥15 单片机学习顺序问题!!
    • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上