タイトルはわかりにくいかもしれませんが、ここではコードを使って説明します。
条件によってはactionContact
、ユーザーが電話をかけてきた場合でも電話をかける場合がありますactionIndex
。
解決策:1
public function actionIndex()
{
$a = 5;
if($a == 5){
$this->actionContact();
}
else{
$this->render('index');
}
}
public function actionContact()
{
// Some codes
$this->render('contact');
}
解決策:2
public function actionIndex()
{
$a = 5;
if($a == 5){
// Repeat code from actionContact method
$this->render('contact');
}
else{
$this->render('index');
}
}
解決策:3連絡先URLにリダイレクトできます。
解決策1は私にとっては問題なく機能すると思いますが、それをお勧めします。しかし、私はyiiを初めて使用するので、その方法がわからないか知りたいのですが。