mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 03:50:56 +08:00
30 lines
510 B
PHP
30 lines
510 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Phalcon\Config;
|
|
use Phalcon\Crypt as PhCrypt;
|
|
|
|
class Crypt extends Provider
|
|
{
|
|
|
|
protected $serviceName = 'crypt';
|
|
|
|
public function register()
|
|
{
|
|
/**
|
|
* @var Config $config
|
|
*/
|
|
$config = $this->di->getShared('config');
|
|
|
|
$this->di->setShared($this->serviceName, function () use ($config) {
|
|
|
|
$crypt = new PhCrypt();
|
|
|
|
$crypt->setKey($config->get('key'));
|
|
|
|
return $crypt;
|
|
});
|
|
}
|
|
|
|
} |