ad

2012年1月18日 星期三

cakephp 重複呼叫自己兩次

在coding時一直遇到鬼打牆的事情
我在寫入db一直重複寫兩次
插裝也查不到任何原因
同事幫我找了一下在外國網站終於有高手解釋了這個問題
當cakephp如果連結路徑有錯時action會重複的呼叫自己兩次
而且在 httpfox找不到
仔細找一找,我還真的有一個js的路徑是錯得
改正之後就正常囉!!感謝親愛的同事~~

Greetings everyone!

I have a strange problem with my cake (cake_1.2.0.7296-rc2). My start()-action runs twice, under certain circumstances, even though only one request is made.

The triggers seem to be : - loading an object like: $this->Questionnaire->read(null, $questionnaire_id); - accessing $this-data

If I disable the call to loadAvertisement() from the start()-action, this does not happen. If I disable the two calls inside loadAdvertisement(): $questionnaire = $this->Questionnaire->read(null, $questionnaire_id); $question = $this->Questionnaire->Question->read(null, $question_id); ... then it doesn't happen either.

Why?

See my code below, the Controller is "questionnaires_controller".


出處於此,如有侵權請通知下架