secret key

In yii basic templates, config/web.php the cookieValidationKey is empty ,may I know how to generate a key for this.

Thank you in advance.

Yii::$app->security->generateRandomKey(32) or the class have some similar methods.

Thank you for the quick reply…where to put that code ? in my controllersite ?

This is not a professional solution, but you can use that method in a model or controller temporarily to generate the key, get the output through any view, in any of your pages you develop, and can use it in the main-local.


why the output looks like this

I put in my site/index controller

   return Yii::$app->security->generateRandomKey(32);

please correct me if I am wrong.