php - PHP 7 上的 TCPDF 错误
问题描述
我正在使用 TCPDF 插件在 PHP 7 中生成 PDF。相同的代码在较低版本的 PHP 5 中运行良好,但是当我在 PHP 7 中运行相同的代码时,它会给出以下错误消息。
A PHP Error was encountered
Severity: 8192
Message: The each() function is deprecated. This message will be suppressed on further calls
Filename: tcpdf/tcpdf.php
Line Number: 16542
解决方案
在文件中编辑:\FPDI\fpdi.php
第 567 行:
//while (list($k, $v) = each($value[1])) {
在代码中:
foreach ($value[1] AS $k => $v) {
并在文件中编辑:\tcpdf\tcpdf.php
第 16543 行:
//while (list($id, $name) = each($attr_array[1])) {
在代码中:
foreach($attr_array[1] as $id => $name) {
推荐阅读
- java - 休眠 - 无法加载请求的类:org.mariadb.jdbc.Driver
- ios - 尝试在我的 SpriteKit 游戏的数组中随机运行一些函数,但它们没有出现在模拟器中
- json - Golang:使用 Go Routines 和 JSON 进行 HTTP 调用和解析 JSON
- c - 从程序中复制 C 程序的整个 bss 和数据段?
- c# - SqlException 未被用户代码处理,关键字事务附近的语法不正确
- android - 用于循环适配器更新的 Android Studio Listview
- python - 关于将PNG转换为JPG
- c# - 使 anim.SetBool 与 NavMeshAgent 一起工作时出现问题
- prolog - 如何避免整数基本情况的非终止?
- css - 闪亮下拉菜单中的不同样式