Cml\Encry::encrypt PHP Méthode

encrypt() public static méthode

加密方法
public static encrypt ( string $data, string $key = null ) : mixed
$data string 加密字符串
$key string 密钥
Résultat mixed
    public static function encrypt($data, $key = null)
    {
        is_null($key) && ($key = Config::get('auth_key'));
        return self::cry(serialize($data), 1, $key);
    }

Usage Example

Exemple #1
0
 /**
  * 设置某个Cookie值
  *
  * @param string $name 要设置的cookie的名称
  * @param mixed $value 要设置的值
  * @param int $expire 过期时间
  * @param string $path path
  * @param string $domain domain
  *
  * @return void
  */
 public static function set($name, $value, $expire = 0, $path = '', $domain = '')
 {
     empty($expire) && ($expire = Config::get('cookie_expire'));
     empty($path) && ($path = Config::get('cookie_path'));
     empty($domain) && ($domain = Config::get('cookie_domain'));
     $expire = empty($expire) ? 0 : Cml::$nowTime + $expire;
     $value = Encry::encrypt($value);
     setcookie(Config::get('cookie_prefix') . $name, $value, $expire, $path, $domain);
     $_COOKIE[Config::get('cookie_prefix') . $name] = $value;
 }
All Usage Examples Of Cml\Encry::encrypt