abs():参数 #1 ($num) 必须为 int|float 类型,给定字符串

发布于 2025-01-18 06:58:00 字数 1416 浏览 1 评论 0原文

我想预览PDF,但在更新到PHP 8和一些软件包更新后不打开。
此代码来自Laravel

function konversi($x)

    {

        $x = abs($x);

        $angka = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan",   "Sembilan", "Sepuluh", "Sebelas");

        $temp = "";

 
> if ($x < 12) {// Notif from laravel in this line


            $temp = " " . $angka[$x];

        } else if ($x < 20) {

            $temp = konversi($x - 10) . " Belas";

        } else if ($x < 100) {

            $temp = konversi($x / 10) . " Puluh" . konversi($x % 10);

        } else if ($x < 200) {

            $temp = " Seratus" . konversi($x - 100);

        } else if ($x < 1000) {

            $temp = konversi($x / 100) . " Ratus" . konversi($x % 100);

        } else if ($x < 2000) {

            $temp = " Seribu" . konversi($x - 1000);

        } else if ($x < 1000000) {

            $temp = konversi($x / 1000) . " Ribu" . konversi($x % 1000);

        } else if ($x < 1000000000) {

            $temp = konversi($x / 1000000) . " Juta" . konversi($x % 1000000);

和此Notif预览,键入错误

abs():参数#1($ num)必须是类型int | float,字符串给定(查看:c:c:\ users \ fauzan azhim \ downloads \ sci-tkdn-fixing_laporan \ sci-tki-tkdn-fixing_laporan \ sci-tkdn-fixing_laporan \ resources \ view \ laporan \ cetak_permen_1.blade.php)

I want to preview pdf, but not open after updated to php 8 and some package update.
This code notif from laravel

function konversi($x)

    {

        $x = abs($x);

        $angka = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan",   "Sembilan", "Sepuluh", "Sebelas");

        $temp = "";

 
> if ($x < 12) {// Notif from laravel in this line


            $temp = " " . $angka[$x];

        } else if ($x < 20) {

            $temp = konversi($x - 10) . " Belas";

        } else if ($x < 100) {

            $temp = konversi($x / 10) . " Puluh" . konversi($x % 10);

        } else if ($x < 200) {

            $temp = " Seratus" . konversi($x - 100);

        } else if ($x < 1000) {

            $temp = konversi($x / 100) . " Ratus" . konversi($x % 100);

        } else if ($x < 2000) {

            $temp = " Seribu" . konversi($x - 1000);

        } else if ($x < 1000000) {

            $temp = konversi($x / 1000) . " Ribu" . konversi($x % 1000);

        } else if ($x < 1000000000) {

            $temp = konversi($x / 1000000) . " Juta" . konversi($x % 1000000);

And this notif preview, Type Error

abs(): Argument #1 ($num) must be of type int|float, string given (View: C:\Users\Fauzan Azhim\Downloads\sci-tkdn-fixing_laporan\sci-tkdn-fixing_laporan\resources\views\laporan\cetak_permen_1.blade.php)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

胡渣熟男 2025-01-25 06:58:00

abs():参数#1($ num)必须为类型int | float,字符串给定
(查看:c:\ users \ fauzan
azhim \ downloads \ sci-tkdn-fixing_laporan \ sci-tkdn-fixing_laporan \ Resources \ resources \ views \ laporan \ cetak_permen_1.blade.blade.php)

  1. 错误来自刀片文件。
  2. 更改此刀片文件abs($ num) <代码> abs((int)$ num)
  3. 重试。

abs(): Argument #1 ($num) must be of type int|float, string given
(View: C:\Users\Fauzan
Azhim\Downloads\sci-tkdn-fixing_laporan\sci-tkdn-fixing_laporan\resources\views\laporan\cetak_permen_1.blade.php)

  1. The error comes from your blade file.
  2. change in this blade file abs($num) to abs((int) $num)
  3. Try again.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文