Generate Random String

wUIAceX4aYfL5lN7vwaGH9zQN-LvOeRc

Generate Random Key

nڞT9" 1 '=


views\site\multiple.php:

<div class="col-sm-12 col-md-6">
    <?php Pjax::begin(); ?>
    <?= Html::a("Generate Random String", ['site/multiple'], ['class' => 'btn btn-lg btn-primary']) ?>
    <h3><?= $randomString ?></h3>
    <?php Pjax::end(); ?>
</div>

<div class="col-sm-12 col-md-6">
    <?php Pjax::begin(); ?>
    <?= Html::a("Generate Random Key", ['site/multiple'], ['class' => 'btn btn-lg btn-primary']) ?>
    <h3><?= $randomKey ?><h3>
    <?php Pjax::end(); ?>
</div>

controllers\SiteController.php:
public function actionMultiple()
{
    $security = new Security();
    $randomString = $security->generateRandomString();
    $randomKey = $security->generateRandomKey();
    return $this->render('multiple', [
        'randomString' => $randomString,
        'randomKey' => $randomKey,
    ]);
}