switchIdentity() public method
Switches to a new identity for the current user. When $enableSession is true, this method may use session and/or cookie to store the user identity information, according to the value of $duration. Please refer to login() for more details. This method is mainly called by login(), logout() and loginByCookie() when the current user needs to be associated with the corresponding identity information.
public void switchIdentity ( $identity, $duration = 0 )$identit