PHP 中的 md5() 函數用於計算字符串的 md5 哈希值。
用法
md5(str, raw)
參數
str - 要計算的字符串
raw − 指定布爾值
TRUE − 原始 16 字符二進製格式
FALSE − 默認。 32 個字符的十六進製數
返回
md5() 函數將哈希作為 32 個字符的十六進製數返回。
示例
以下是一個例子 -
<?php
$s = "Welcome!";
echo md5($s);
?>
輸出
9a843f20677a52ca79af903123147af0
示例
以下是一個例子 -
<?php
$s = "Welcome";
echo md5($s);
if (md5($s) == "83218ac34c1834c26781fe4bde918ee4") {
echo "\nWelcome";
exit;
}
?>
輸出
83218ac34c1834c26781fe4bde918ee4 Welcome
相關用法
- PHP md5_file()用法及代碼示例
- PHP metaphone()用法及代碼示例
- PHP mhash_get_hash_name()用法及代碼示例
- PHP mysqli_get_server_info()用法及代碼示例
- PHP money_format()用法及代碼示例
- PHP mysqli_data_seek()用法及代碼示例
- PHP mysqli_insert_id()用法及代碼示例
- PHP mysqli_fetch_assoc()用法及代碼示例
- PHP mkdir()用法及代碼示例
- PHP mysqli_connect_error()用法及代碼示例
- PHP mhash_keygen_s2k()用法及代碼示例
- PHP microtime()用法及代碼示例
- PHP mysqli_fetch_all()用法及代碼示例
- PHP mt_rand( )用法及代碼示例
- PHP mysqli_next_result()用法及代碼示例
- PHP mysqli_stmt_affected_rows()用法及代碼示例
- PHP mime_content_type()用法及代碼示例
- PHP mysqli_begin_transaction()用法及代碼示例
- PHP mysqli_real_escape_string()用法及代碼示例
注:本文由純淨天空篩選整理自Ankith Reddy大神的英文原創作品 md5() function in PHP。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。