未定义函数 bcsub()
Undefined Function bcsub()
我在本地使用此代码 Laravel 并且成功了
public function dateForHuman($custom_timestamp)
{
$date = bcsub($custom_timestamp, 25569, 10) * 86400;
return date('Y-m-d H:i:s', $date);
}
但是当我在我的服务器中尝试时,响应错误 Undefined Function bcsub()
根据 PHP 文档,默认情况下 BCMath 在 Linux 服务器上的 PHP7 中不可用。
bcmath ist 未随 php7 在 linux(ubuntu 服务器上自动安装)您必须使用:sudo apt-get install php-bcmath
请使用apt-get安装: sudo apt-get install php-bcmath
我在本地使用此代码 Laravel 并且成功了
public function dateForHuman($custom_timestamp)
{
$date = bcsub($custom_timestamp, 25569, 10) * 86400;
return date('Y-m-d H:i:s', $date);
}
但是当我在我的服务器中尝试时,响应错误 Undefined Function bcsub()
根据 PHP 文档,默认情况下 BCMath 在 Linux 服务器上的 PHP7 中不可用。
bcmath ist 未随 php7 在 linux(ubuntu 服务器上自动安装)您必须使用:sudo apt-get install php-bcmath
请使用apt-get安装: sudo apt-get install php-bcmath