0

i have a function in my appController ..i am not good in arrays so i want to merge these two functions

First Array

public $components = array(
    'Session',
    'Auth'=>array(
        'loginRedirect'=>array('controller'=>'users', 'action'=>'controlpanel'),
        'logoutRedirect'=>array('controller'=>'users', 'action'=>'index'),
        'authError'=>"You can't access that page",

        'authorize'=>array('Controller'),
        'authenticate' => array(
            'Form' => array(
                'fields' => array('username' => 'email')


            )
        )
    )
);

second Array

$this->Auth->authenticate = array(
        'Authenticate.MultiColumn' => array(
            'fields' => array(
                'username' => 'email',
                'password' => 'password'
            ),
            'columns' => array('email', 'mobileNo'),
            'userModel' => 'User',

        )
    );

what i want is i want to add Second function into first function if that possible

4

1 回答 1

0

假设您要按照描述中的描述合并两个数组(而不是排列),那么您应该使用 CakePHP 的 Hash 类,特别是合并函数。您可以在文档中阅读更多内容。

$merged_array = Hash::merge($array1, $array2);
于 2013-06-15T18:06:46.200 回答