这并不总是发生。我有时可以上传相同的GIF,有时会收到这个错误,看起来几乎是随机的。
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*001/*.org/www/inc/classes/board-post.class.php on line 81
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 343
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 347
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 350
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/posts.php on line 249
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 136
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 163
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/fetching.php on line 27
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 343
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 443
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/fetching.php on line 27
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/inc/func/misc.php on line 76
答案 0 :(得分:1)
某处您使用的变量不是foreach
语句中的数组,例如:
$foo = 123;
foreach ($foo as $bar)
这会抛出Invalid argument supplied for foreach()
警告。更好地检查你的变量,以确保它们是预期的阵列。
抛出此警告并输出阻止发送标头的事实,这会导致另一个Cannot modify header information
警告。
答案 1 :(得分:0)
如果要遍历$results
数组,则应编写
foreach ($results as $key=>$value)
而不是
foreach ($results[0] as $key=>$value)
除非$results[0]
本身是一个数组,在这种情况下$results
将是一个矩阵(数组数组)。