PHP手冊整理 函式 內建函式(加密函式)

2021-10-25 12:55:02 字數 898 閱讀 2735

hash_file、md5_file 函式:

// hash_file — 使用給定檔案的內容生成雜湊值

// md5_file — 計算檔案的md5值

// md5_file('./test.php')等同於hash_file('md5','./test.php');

echo

md5_file

('./test.php');

echo

'---'

;echo

hash_file

('md5'

,'./test.php'

);

hash、md5 函式:

// hash — 生成雜湊值 (訊息摘要)

// md5 — 計算字串的 md5 雜湊值

echo

hash

('sha512'

,'需要生成hash的字串');

echo

md5(

'需要生成md5值的字串'

)

password_hash 函式:

// password_hash  — 單向字串雜湊

$str

='123456'

;$pwd

=password_hash

($str

,password_default,[

'cost'

=>12]

);var_dump

(password_verify

('123456'

,$pwd))

;

PHP手冊整理 函式 內建函式(網路)

header 函式 header 傳送原生 http 頭 url重定向 header location 設定響應狀態碼 響應乙個pdf檔案 header header content disposition attachment filename downloaded.pdf readfile or...

PHP手冊整理 函式 內建函式(數學相關)

abs 絕對值 abs abs 4.2 abs 4.2 double float abs3 abs 5 abs3 5 integer bindec 二進位制轉換為十進位制 echo bindec 110011 n ceil 進一法取整 echo ceil 1.26 1 decbin 十進位制轉換為二...

PHP手冊整理 函式 自定義函式

宣告函式格式 function func 引數1 預設值,引數2,無引數函式 宣告無引數函式 function getconfig 呼叫無引數函式 config getconfig var dump config 固定引數函式 宣告帶引數函式 function getconfig key 呼叫帶引數...