私のCakePHPアプリケーションでは、管理者が管理者用に定義されたアクションだけにアクセスできるようにURL検証を適用しました。 私のアプリケーションでは、 "surveylist"はadminのアクションであり、ユーザーがそのアクション(surveylist)に直接アクセスすると、URL検証が機能します(Unauthorized access msgが表示されます)。 しかし、そのメッセージの下で、surveylistのctpファイルは強制的に実行され、エラーを表示します。これは、try-catchブロックを介してURLを検証し、アクションの設定変数を取得できないためです。 不正なエラーが発生した場合、そのctpファイルを実行しないでください。cakephp 2.xでctpファイルの実行を停止する方法
surveylistのための私のコードは次のとおりです。 -
public function surveylist($pg=null){
try{
if($this->checkPageAccess($this->params['controller'] . '/' . $this->params['action'])){
$this->Paginator->settings = array(
'Survey' => array(
'limit' => 5,
'order' => 'created desc',
'conditions'=>array('is_deleted'=> 0),
'page' => $pg
)
);
$numbers = $this->Paginator->paginate('Survey');
$this->set(compact('numbers'));
}else{
$this->Flash->set(__('Unauthorised access'));
}
}catch(Exception $e){
$this->Flash->set(__($e->getMessage()));
}
}
コントロールが他に来る場合、私は実行するsurveylistのCTPファイルを望んでいません。 Plz、助けてください...... Thanx in advance ...
thanx alot sir .... –