最近我升级了我的php,突然出现这个错误
弃用:不推荐使用 each() 函数。此消息将在第 65 行的 /modules/Downloads/admin/CategoryModify.php 中进一步调用时被抑制
, htmlspecialchars($cidinfo['cdescription'], ENT_QUOTES, _CHARSET) , '</textarea><br />' , _DL_ALLOWED_HTML , '<br />';
while (list($key) = each($AllowableHTML)) echo ' <' , $key , '>';
不知道这个问题有没有解决方案
我尝试用 foreach 进行一些更改,但我想它比这更复杂。
I've got this as well trying to play as well deprecated。解决方案应该是什么?
//if( !@get_magic_quotes_gpc() ){
ini_set('magic_quotes_runtime', 0);{
if( is_array($HTTP_GET_VARS) )
{
while( list($k, $v) = each($HTTP_GET_VARS) )
{
if( is_array($HTTP_GET_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
{
$HTTP_GET_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_GET_VARS[$k]);
}
else
{
$HTTP_GET_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_GET_VARS);
}
if( is_array($HTTP_POST_VARS) )
{
while( list($k, $v) = each($HTTP_POST_VARS) )
{
if( is_array($HTTP_POST_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
{
$HTTP_POST_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_POST_VARS[$k]);
}
else
{
$HTTP_POST_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_POST_VARS);
}
if( is_array($HTTP_COOKIE_VARS) )
{
while( list($k, $v) = each($HTTP_COOKIE_VARS) )
{
if( is_array($HTTP_COOKIE_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
{
$HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_COOKIE_VARS[$k]);
}
else
{
$HTTP_COOKIE_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_COOKIE_VARS);
}
}
你的
Foreach
声明应该这样写:
foreach($AllowableHTML as $key => $value){
echo "$key"; //This displays the index of the element in the array
echo "<". $value. ">"; //This displays the value
}