PHP 7.4-警告:count():参数必须为数组

问题描述 投票:0回答:1

我刚刚将PHP版本从5.6升级到7.4。我在页面中使用了count()函数,例如:

                       $watch_server_count  = count($watch_server);
                       if ($watch_server_count > 0) {
                           foreach ($watch_server->table as $key=> $watch_server_rows) {

警告:count():参数必须是在以下位置实现Countable的数组或对象:>

我刚刚将我的PHP版本从5.6升级到7.4。我在页面中使用了count()函数,例如:$ watch_server_count = count($ watch_server);如果($ ...

php count php-7 php-7.4 countable
1个回答
0
投票

您只需要先定义变量即可在数组中使用它。请在下面检查。

© www.soinside.com 2019 - 2024. All rights reserved.