sha1()函數(shù)用于計算字符串的 sha1 散列值。
string sha1 ( string $str [, bool $raw_output = false ] )
用于計算字符串的 sha1 散列值。
它返回字符串的sha1 散列值。
序號 | 參數(shù)與說明 |
---|---|
1 | str(必需) 輸入字符串。 |
2 | raw_output 可選。如果 raw_output 參數(shù)被設置為 TRUE, 那么 sha1 摘要將以 20 字符長度的原始格式返回, 否則返回值是一個 40 字符長度的十六進制數(shù)字 |
試試下面的實例,計算網(wǎng)址字符串"(cainiaoplus.com)"的散列值:
<?php //計算網(wǎng)址字符串"(cainiaoplus.com)"的散列值: $input = "(cainiaoplus.com)"; echo sha1($input); ?>測試看看?/?
輸出結果
4ba7014d345010557e9ac4ed7d8c3e1c6b1e3d36