PHP数组打印'array'而不是值. [英] PHP array printing 'array' instead of values.

查看:56
本文介绍了PHP数组打印'array'而不是值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码,但无法弄清楚这是怎么回事.

I am using this code but can't figure out what's wrong with it.

if (!empty($_POST)) {
    foreach ($_POST as $key => $value) {
        if (get_magic_quotes_gpc()) 
            $value=stripslashes($value);
        if ($key=='extras') {       
            if (is_array($_POST['extras'])) {
                print "<tr><td><code>$key</code></td><td>";
                foreach ($_POST['extras'] as $value) {
                print "<i>$value</i><br />";
                }
                print "</td></tr>";
                } 
            else {
                print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
                }
            } 
        else {
            print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
        }
    } // end foreach
}

它在表中打印prgm'array'而不是数组中的值.

It prints prgm 'array' in table instead of values inside array.

推荐答案

我想使用

I feel like using print_r() would be at least a way to gain some insight into the structure of the array.

这篇关于PHP数组打印'array'而不是值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆