【问题标题】:A non-numeric value encountered laravellaravel 遇到一个非数值的值
【发布时间】:2019-01-26 12:53:22
【问题描述】:

我正在传递值以在 laravel 控制器中打印 pdf。在本地机器上它工作得很好,但在实时服务器上它显示“遇到非数字值”错误。

我使用 barrvdh dom pdf 打印 pdf

【问题讨论】:

    标签: laravel dompdf


    【解决方案1】:

    在使用 PHP 7.1 或更高版本的系统上运行 Dompdf 版本

    确保您使用的是 Laravel-Dompdf 0.8.0 或更高版本 (releases)。

    【讨论】:

    • 这对 Laravel 4 用户有用吗?网站github.com/barryvdh/laravel-dompdf/tree/0.4 说要对 Laravel 4 使用 "barryvdh/laravel-dompdf": "0.4.*" : (
    • 我不确定,因为我不是 laravel 用户,但它看起来不像。 .4 分支已经有一段时间没有更新了。此外,.4 基于较旧版本的 dompdf,因此您甚至无法使用没有问题的较新版本的 dompdf。
    【解决方案2】:

    我遇到了同样的问题,并通过以下解决方案解决了第 436 行的“cellmap.cls.php”

    /**Old Code:**/
    
    // Determine where this cell is going
    $colspan = $node->getAttribute("colspan");
    $rowspan = $node->getAttribute("rowspan");
    
    if ( !$colspan ) {
       $colspan = 1;
       $node->setAttribute("colspan",1);
    }
    
    if ( !$rowspan ) {
        $rowspan = 1;
        $node->setAttribute("rowspan",1);
    }
    
    /**New Code:**/
    
    if(method_exists($node,'getAttribute')){
        // Determine where this cell is going
        $colspan = $node->getAttribute("colspan");
        $rowspan = $node->getAttribute("rowspan");
    
        if ( !$colspan ) {
           $colspan = 1;
           $node->setAttribute("colspan",1);
        }
    
        if ( !$rowspan ) {
            $rowspan = 1;
            $node->setAttribute("rowspan",1);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-28
      • 2018-03-10
      • 2018-10-30
      • 1970-01-01
      相关资源
      最近更新 更多