调用未定义的函数password_hash()

问题描述:

在我开发网站时,我现在正在本地主机上运行php版本5.4.16.我想使用password_hash(),但我不断收到此错误:

I am running php version 5.4.16 on localhost right now, while I am developing my site. I want to use password_hash(), but I keep getting this error:

致命错误: 123

为什么会这样?

谢谢!

新的password_*方法仅在PHP 5.5及更高版本中可用:

The new password_* methods are only available as of PHP 5.5:

http://www.php.net/manual/en/function.password-hash .php

看看这个提供前向兼容性的库:

Take a look at this library that provides forward compatibility:

https://github.com/ircmaxell/password_compat

您可以使用它来访问新的password_*方法,直到能够运行PHP 5.5.

You can use that to get access to the new password_* methods until you are able to run PHP 5.5.