0
내 애플리케이션에서 맞춤 URL을 사용했습니다. 메시지를 만들면 양식을 생성하도록 리디렉션되지만 양식을 제출할 때 다시 같은 양식으로 리디렉션됩니다. $ _POST 변수가 설정되어 있으면 제어기에 조건이 있고 그 다음에 다른 변수를 저장하여 양식으로 재 지정합니다. 나는 $ _POST 변수가 설정되어 있지 않다고 생각했지만 양식에 인쇄 할 때 거기에 인쇄되었습니다. 그래서 $ _POST 변수가 설정되면 조건이 실패하는 이유는 무엇입니까? 다음은 내 맞춤 URL입니다. 사용자 지정 URL을 사용하기 전에 확인 작업을하고있었습니다.
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'' => 'questions/index',
'messages' => 'messages/index',
'tags' => 'tags/index',
'login' => 'site/login',
'signup' => 'users/create',
'<id:\w+>' => 'users/view',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'gii' => 'gii',
'gii/<controller:\w+>' => 'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>' => 'gii/<controller>/<action>',
),
),
그리고 내 .htaccess 파일입니다.
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
여기에 문제가 있습니까?
편집
여기 내 컨트롤러 코드입니다.
public function actionUpdate($id) {
$model = $this->loadModel($id);
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->save())
$this->redirect(array('view', 'id' => $model->id));
}
$this->render('update_info', array(
'model' => $model,
));
}
컨트롤러 코드는 어디에 있습니까? – DevZer0
사용자 정의 URL은이 bahavior에 영향을 미치지 않아야합니다. 어쩌면 일부 코드를 다른 위치로 변경했을 수 있습니다. 컨트롤러 액션 코드를 게시 할 수 있습니까? –
그래서 제출하면 데이터가 db로 저장됩니까? 일반적으로 컨트롤러에서 리디렉션 통화에 문제가있을 수 있지만 게시되지는 않습니다. 구성 파일이나 .htaccess 파일에 문제가 보이지 않습니다. – cliffbarnes