The session expired after the front-end Ajax request returned the HTML code. The back-end was developed with PHP. Is there any good way to solve it?
为情所困2017-05-16 13:03:18
The session expired return html code can be customized. Determine whether the session has expired before returning html
習慣沉默2017-05-16 13:03:18
Return to json, the front-end will prompt to log in after global interception
怪我咯2017-05-16 13:03:18
Return to the corresponding status. When the front-end determines the status, if the session fails, a prompt box will pop up. When the user presses OK, the login interface will be redirected
ringa_lee2017-05-16 13:03:18
Every time you make a request, you must determine whether the session has expired, that is, determine the user's login status. If it expires, return a custom error code, such as returning 400, illegal user request, etc.
I don’t know what you mean? Are you saying that information can be obtained even if the user is not logged in?
習慣沉默2017-05-16 13:03:18
The PHP interface returns the corresponding status value, success is 1, failure is 0 and carries an error message. The previous ajax process is based on the return value. When the status is 1, the data is rendered. Otherwise, the corresponding error message pops up and the corresponding jump login is performed. page operations.