0
我有一個像下面兩個數組:合併兩個單獨的數組在PHP
array
'result1' =>
array
'entities' =>
array
0 =>
object(ElggUser)[979]
...
'count' => int 1
array
'result2' =>
array
'entities' =>
array
0 =>
object(ElggUser)[983]
...
1 =>
object(ElggUser)[986]
...
2 =>
object(ElggUser)[989]
...
3 =>
object(ElggUser)[992]
...
4 =>
object(ElggUser)[995]
...
5 =>
object(ElggUser)[998]
...
6 =>
object(ElggUser)[1001]
...
7 =>
object(ElggUser)[1004]
...
8 =>
object(ElggUser)[1007]
...
9 =>
object(ElggUser)[1010]
...
'count' => int 1453
所以我試圖array_merge這就像array_merge($results1["result1"],$results2["result2"]);
但我正在逐漸如何做到這一點的第2個數組的結果呢?我得到的結果一樣:
array
'entities' =>
array
0 =>
object(ElggUser)[983]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
1 =>
object(ElggUser)[986]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
2 =>
object(ElggUser)[989]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
3 =>
object(ElggUser)[992]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
4 =>
object(ElggUser)[995]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
5 =>
object(ElggUser)[998]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
6 =>
object(ElggUser)[1001]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
7 =>
object(ElggUser)[1004]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
8 =>
object(ElggUser)[1007]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
9 =>
object(ElggUser)[1010]
protected 'attributes' =>
array
...
protected 'url_override' => null
protected 'icon_override' => null
protected 'temp_metadata' =>
array
...
protected 'temp_annotations' =>
array
...
protected 'volatile' =>
array
...
private 'valid' (ElggEntity) => boolean false
'count' => int 1453
好吧,我解決它以另一種方式。我採取了result1 [「實體」]和結果2 [「實體」],然後我得到了我想要的值。 –