我有一个看起来像这样的数组,
Array
(
[candidate_id] => 1
[first_name] => Simon
[surname] => Ainley
[gender] => male
[talent] => presenter
[DOB] => 1987-06-12
[Location] => Huddersfield
[height] => 6' 3"
[eyes] => blue
[hair] => brown
[hair_length] => short
[accents] => Native english
[training] => none
[unions] => Actors guild
[date_created] => 2011-10-11 00:00:00
)
但是当我不满意时,
<?php foreach ($results as $k => $v) : ?>
<?php print_r($v); ?>
<?php endforeach; ?>
使用这个我得到输出,
1 S A m p 1 H 6 b b s N n A 2
答案 0 :(得分:1)
当您尝试回显一个实际上是字符串的数组元素时会发生这种情况。例如
$string = "hello";
echo $string[1]; // echos "e"
确保$ results的结构符合您的想法,并且您在正确的变量上使用print_r()。