日期:2014-05-17  浏览次数:20476 次

在目录移动到另一个目录时,下面两种格式有什么区别?求解!!
(移动目录)
if ( !empty( $testCategoryData) ) {
$data[0] = array_shift($testCategoryData);
$data[0]['children'] = $testCategoryData;
}


 (移动用例)
$data = array();
$data[0]= $testCategoryData[0]; 
        for ( $index = 1; $index < count($testCategoryData); $index++ ) {
       $data[0]['children'][$index-1] = $testCategoryData[$index]; 
        } 
移动开发 php??? php 移动目录

------解决方案--------------------
for ( $index = 1; $index < count($testCategoryData); $index++ ) { //从下标1开始,直到最后
       $data[0]['children'][$index-1] = $testCategoryData[$index]; //抄写每个元素到目标数组