How to implement login diary with Yii framework
Administrators can view the history of the logged on system. Includes information about failures and successes.
The diary information is: Login IP, login user name, information description. Login time.
The main is how to record this information and then show it, want to use the file to record this information.
------Solution--------------------
Write a log class yourself, the record is.
------Solution--------------------
. ***.***.***; Login username 1; information description 1; Login Time 1
. ***.***.***; login username 2; information description 2; login Time 2
. ***.***.***; login username 3; information description 3; login Time 3
···
···
To Explode into a string and then each record line file_put_contents to the file
You can also put each record into a long string with a symbol
read out only the number of the style of the display of the landlord can design their own
------Solution--------------------
Inherit the Cuseridentity class, rewrite the Authenticate method, add log in the Authenticate method to log the data!
A relatively simple approach using the Error_log method
Error_log ($msg, 3, ' Login_log ');
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service