怪我咯2017-04-17 15:30:45
Obviously your username is not defined
Try adding an if judgment to your second middleware
PHP中文网2017-04-17 15:30:45
The two usernames are in different scopes, of course they are undefined...
怪我咯2017-04-17 15:30:45
These are the variables of two methods. The second one cannot refer to the username in the first method. Use req.session.username again and get it once.