Error reported using YII exit function, logout? not found

sign out as written in the document:

Yii::app()->user->logout();

the result reported a 500 error.

ERROR: 2018-06-28 14:18:20 ip[127.0.0.1] requestId[951106107] [exception.CException] callId[0] []    CException: Session and its behaviors do not have a method or closure named "logout". in
Mar.29,2021

from the error message, the logout method was not found, and the magic method was performed, but still not. It should be that User comment is not configured correctly so that the user corresponding to app is not a subclass of yiiwebUser. It is also possible that because there is no login, user is a guest identity, but this should not be the case with the error message.

Menu