mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
Fixed #5769: fixed method names in Security guide
This commit is contained in:
@ -56,7 +56,7 @@ For example, we need to store some information in our database but we need to ma
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
// $data and $secretKey are obtained from the form
|
// $data and $secretKey are obtained from the form
|
||||||
$encryptedData = Yii::$app->getSecurity()->encrypt($data, $secretKey);
|
$encryptedData = Yii::$app->getSecurity()->encryptByPassword($data, $secretKey);
|
||||||
// store $encryptedData to database
|
// store $encryptedData to database
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ Subsequently when user wants to read the data:
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
// $secretKey is obtained from user input, $encryptedData is from the database
|
// $secretKey is obtained from user input, $encryptedData is from the database
|
||||||
$data = Yii::$app->getSecurity()->decrypt($encryptedData, $secretKey);
|
$data = Yii::$app->getSecurity()->decryptByPassword($encryptedData, $secretKey);
|
||||||
```
|
```
|
||||||
|
|
||||||
Confirming data integrity
|
Confirming data integrity
|
||||||
|
Reference in New Issue
Block a user