修复Warning: array_merge() [function.array-merge]: Argument #1 is not an array in 错误
最近,在调试一个周公解梦的php程序,传上去后却出现了如下的错误:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/public_html/checkpostandget.php on line 26
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/public_html/checkpostandget.php on line 26
Warning: Invalid argument supplied for foreach() in /home/public_html/checkpostandget.php on line 37
找到第26行后,发现是这个样子的
$ArrPostAndGet=array_merge($HTTP_POST_VARS,$HTTP_GET_VARS);
改成如下样子:
$ArrPostAndGet=array_merge((array)$HTTP_POST_VARS,(array)$HTTP_GET_VARS);
后问题解决