我有 7 个对象数组。每个对象都包含数据。我需要将这些数组合并在一起,我这样做:
$arrayTotal = $array1;
$arrayTotal = array_merge($arrayTotal,$array2)
$arrayTotal = array_merge($arrayTotal,$array3)
$arrayTotal = array_merge($arrayTotal,$array4)
...
一切都很好,直到我的总数组有 700 个项目(每个子数组有 100 个项目)。Apache 停止响应,我认为是因为内存问题,因为有这么多的大数组。我在第 4 次或第 5 次合并时遇到了问题。
合并它们并避免错误的最佳方法是什么?
更新:
[Sat Sep 15 10:17:36 2012] [notice] Apache/2.2.21 (Win32) PHP/5.3.9 configured -- resuming normal operations
[Sat Sep 15 10:17:36 2012] [notice] Server built: Sep 10 2011 11:34:11
[Sat Sep 15 10:17:36 2012] [notice] Parent: Created child process 3908
[Sat Sep 15 10:17:36 2012] [notice] Child 3908: Child process is running
[Sat Sep 15 10:17:36 2012] [notice] Child 3908: Acquired the start mutex.
[Sat Sep 15 10:17:36 2012] [notice] Child 3908: Starting 64 worker threads.
[Sat Sep 15 10:17:36 2012] [notice] Child 3908: Starting thread to listen on port 8080.
[Sat Sep 15 10:17:53 2012] [notice] Parent: child process exited with status 3221225477 -- Restarting.
这是我的 apache 错误日志。我确实找到了一些将文件复制到我的 system32 文件夹的解决方案,但它们没有用