2011-12-16 104 views
12

我有這樣的PHP代碼:未定義功能SHA256()

$password = sha256($_POST['password']); 

但是當我運行這段代碼,它說:

Fatal error: Call to undefined function sha256() in .... on line ...ix it as 

什麼不對這個代碼,我必須做些什麼來解決什麼這是因爲我知道sha256存在。

我也曾嘗試:

$password = sha256(trim($_POST['password'])); 

但是,這並不工作。

+0

是sha156或SHA256? – ajreal 2011-12-16 11:29:09

回答

5

Suhosin擴展將功能sha256(),甚至sha256_file(),到PHP核心。

與擴展安裝:

<?php 
var_dump(function_exists('sha256')); 
?> 

bool(true)