致命错误:调用未定义的函数random_bytes() [英] Fatal error: Call to undefined function random_bytes()
问题描述
我正在使用php 5.6.23-0 + deb8u1,在我的代码中我想使用功能random_bytes
,但出现此错误:
I'm using php 5.6.23-0+deb8u1 and in my code I want use the function random_bytes
but I get this error:
致命错误:调用未定义的函数random_bytes()
Fatal error: Call to undefined function random_bytes()
我想知道是否需要导入某些东西,或者是否不包含在此版本的php中,在这种情况下,如何替换它?
I want to know if I need to import something or isn't included in this version of php, in this case, how can I replace it?
推荐答案
random_bytes()使用PHP 7.
如手册中所述:
注意:尽管此功能已在PHP 7.0中添加到PHP,但»用户空间实现适用于PHP 5.2至5.6(含).
Note: Although this function was added to PHP in PHP 7.0, a » userland implementation is available for PHP 5.2 to 5.6, inclusive.
您可以将该用户域实现用作反向端口: https://github.com/paragonie/random_compat
You can use that userland implementation as a backport: https://github.com/paragonie/random_compat
这篇关于致命错误:调用未定义的函数random_bytes()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!