PHP7:mcrypt_cbc不起作用

please help to solve the problem.

how to make it work for on php 7 ?

function decr($string) {
    $key="";
    $iv = mcrypt_create_iv(mcrypt_get_block_size (MCRYPT_CAST_32, MCRYPT_MODE_CFB), MCRYPT_DEV_RANDOM);
    $string = base64_decode(trim($string));
    $dec =  mcrypt_cbc (MCRYPT_TripleDES, $key, $string, MCRYPT_DECRYPT, $iv);
    return $dec;
}

I had recently this problem in an app, i did not use mcrypt_encrypt() as suggested because of :

Warning This function has been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.

I did it using openssl (php-openssl) this way :

function _encrypt($data){
    $initialVector = openssl_random_pseudo_bytes(16, $secure);
    $secretKey = '<SECRET_KEY>'; // string : 16 length
    return  openssl_encrypt($data, "aes-128-cbc", $secretKey, OPENSSL_RAW_DATA, $initialVector);
}


function _decrypt($data){
    $initialVector = openssl_random_pseudo_bytes(16, $secure);
    $secretKey = '<SECRET_KEY>'; // string : 16 length
    return  openssl_decrypt($data, "aes-128-cbc", $secretKey, OPENSSL_RAW_DATA, $initialVector);
}

Note : initial vector/secret key generated this way is just for example