函數 i_array_column($input, $columnKey, $indexKey=null){
if(!function_exists('array_column')){
Key ))?true:false;
$indexKeyIsNull = (is_null($. ;
$結果 ();
foreach((array)$input as $key=>$row){
_slice($row, $columnKey, 1);
$tmp= (is_array($tmp) && !empty($tmp))?current($tmp):null; }
if(!
$key = array_s蝨子($row, $indexKey, 1);
$ key =(is_Array($ key)&&!empty($ key))? current($ key):null;
$ key = is_null($ key)? >} el 糖尿病{
$key = isset($row[$indexKey])?$row[$indexKey]:0 }
$結果[$tmp] = ;
}
return $result;
}else{
return unction randcode($len, $ mode = 2){
$rcode = '';
switch($mode){
情況1: // char ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghijkmn p qrstuvwxyz ' ;
break; break; break;
case 3: //全數字+大小字母
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxy //全數字+大小寫字母+一些特殊字元
$chars = 'ABCDEF GHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvxywxygXYZ0123456789abcdefghijklmnopqrstuvxywxyw; )';
break;
}
$count = strlen($chars) - 1;
for($i = 0 ; $i $rcode .= $chars[mt_rand(0, $count)];
}
return $rcode
}
🎜>函數authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 4;
$key = md5($key); $keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? $keya.md5($ keya.$keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string ;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$box = range(0, 255);
$box = range(0, 255);
$box = range(0, 255);
$i = 0; $i $rndkey[$i] = ord($cryptkey[$i % $key_length]);
] $j = ($j + $box[$i] + $rndkey[$i]) % 256;
$ ];
$box[$i] = $box[$j];
$box[$j] = $tmp;
for = $ 0; $i $a = ($a + 1) % 256;
$j = ($j + $box[$a]) % $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp; }
if($operation == '解碼') {
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 10) - time() > 0) && substr($result, 10, 16) == str( md5 (substr($result, 26).$keyb), 0, 16)) {
return substr($result, 26);
return substr($result, 26);
return '';
}
} else {
return $keyc.str_replace('=', '', base64_encode($result));
以上就介紹了加密解密PHP加密解密類,包含了加密解密的內容,希望對PHP教學有興趣的朋友有幫助。