PHP CLI - get user input while still doing things in background
问题 I'm working on a game, written in PHP and that runs in a console. Think back to old MUDs and other text-based games, even some ASCII art! Anyway, what I'm trying to do is have things happening while also accepting user input. For instance, let's say it's a two player game and Player 1 is waiting for Player 2 to make a move. This is easily done by just listening for a message. But what if Player 1 wants to change some options? What if they want to view details on aspects of the game state?