PHP中无效的争论 [英] Invalid arguements in php
问题描述
当我在Wamp中运行脚本时,会收到第17行和第21行的以下警告通知.这告诉我什么,以及可以/应该采取什么措施来解决此问题?
When I run a script in Wamp I get the following Warning Notifications for line 17 and 21. What is this telling me and what can/should be done to resolve the issue ?
警告:在第17行中为C:\ wamp \ www \ eCardScript \ ecard_lib.php中的foreach()提供了无效的参数 * 警告: *在C:\ wamp \ www \ eCardScript \ ecard_lib.php中,在第21行
Warning: Invalid argument supplied for foreach() in C:\wamp\www\eCardScript\ecard_lib.php on line 17 *Warning:* Invalid argument supplied for foreach() in C:\wamp\www\eCardScript\ecard_lib.php on line 21
<?php
include('htmlMimeMail.php');
function getPostGetVars() {
global $HTTP_POST_VARS,$HTTP_GET_VARS;
foreach ($HTTP_POST_VARS as $key => $value) { // This is Line 17
global $$key;
$$key = $value;
}
foreach ($HTTP_GET_VARS as $key => $value) { // This is Line 21
global $$key;
$$key = $value;
}
}
?>
推荐答案
请改用$_GET
和$_POST
.
http://php.net/manual/en/language.variables.预定义.php
从PHP 5.0.3开始,长的预定义数组(例如HTTP_GET_VARS)在默认情况下被禁用.为了向后兼容,您可以在php.ini中启用它们....
From PHP 5.0.3 long predefined arrays such HTTP_GET_VARS got disabled by default. For backward compatibility you can enable them in php.ini....
这篇关于PHP中无效的争论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!