简体   繁体   中英

yii2 create a button without any model field

I need to have two buttons on my home page, Login and Register. When user click on Login button I need to render a LoginView, while on Register button there will be RegisterView. I see these questions but these also have fields in model(dynamic model):

ActiveForm without model yii2

Yii2 create a form without a model

I don't want to use any model field, I only want to render different view on click event to different buttons. Or in other words, how can I set a button to call specific controller's action on its click event?

How this can be done with Yii2 framework.

采用

<?= Html::a('label', ['/controller/action'], ['class'=>'btn btn-primary']) ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM