Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 警告:为foreach()提供的参数无效,字体加载问题_Php_Wordpress_Google Font Api - Fatal编程技术网

Php 警告:为foreach()提供的参数无效,字体加载问题

Php 警告:为foreach()提供的参数无效,字体加载问题,php,wordpress,google-font-api,Php,Wordpress,Google Font Api,你能帮我纠正这个错误吗? 字体将不会加载。 我不知道这部分代码到底在做什么。 完整代码: 第653行: foreach ( $body['items'] as $font ) { $fonts[ $font['family'] ] = $font['family']; } 更改如下- foreach ( $body['items'] ?? [] as $font ) { $fonts[ $font['family'] ] = $f

你能帮我纠正这个错误吗?
字体将不会加载。
我不知道这部分代码到底在做什么。
完整代码:

第653行:

foreach ( $body['items'] as $font ) {
            $fonts[ $font['family'] ] = $font['family'];
        }
更改如下-

foreach ( $body['items'] ?? [] as $font ) {
            $fonts[ $font['family'] ] = $font['family'];
        }

var_转储什么($body['items')显示?请不要显示代码的图像。所有与您的问题相关的代码都以文本形式直接属于您的问题,并且格式正确。这将删除错误,这意味着$body数组没有具有“items”名称的键。因此,它会将其设置为空数组。