PHP7中文手册2018 带注释 最新chm版
views\site\time-date.php:
controllers\SiteController.php:
<?php Pjax::begin(); ?> <?= Html::a("Show Time", ['site/time'], ['class' => 'btn btn-lg btn-primary']) ?> <?= Html::a("Show Date", ['site/date'], ['class' => 'btn btn-lg btn-success']) ?> <h1>It's: <?= $response ?></h1> <?php Pjax::end(); ?>
controllers\SiteController.php:
public function actionTime() { return $this->render('time-date', ['response' => date('H:i:s')]); } public function actionDate() { return $this->render('time-date', ['response' => date('Y-M-d')]); }
转载请注明:谷谷点程序 » yii2 pajax切换时间日期的方法