以下算法增加了公司阵列的用户。 我想为任何特定公司增加一个用户。 我怎么去做。
public function all_company_information($id = null){
$arrCompany = array();
$arrCompany[ company ]= array();
$arrData = array();
$this->autoRender = false;
$this->loadModel("User");
$users = $this->User->find( all );
foreach($users as $k => $user){
if(!in_array($user[ User ][ company_id ], $arrCompany[ company ])){
$arrCompany[ company ][$user[ User ][ company_id ]][] = $user;
}else{
$arrCompany[ company ][$user[ User ][ company_id ]][] = $user;
}
}
}