문제

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 ?

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;
  }
}
?>
도움이 되었습니까?

해결책

Use $_GET and $_POST instead.

http://php.net/manual/en/language.variables.predefined.php

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....

다른 팁

$HTTP_POST_VARS and $HTTP_GET_VARS are deprecated. You should use $_POST and $_GET respectively.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top