Home  >  Article  >  Backend Development  >  What is the equivalent of reading from php standard input?

What is the equivalent of reading from php standard input?

王林
王林forward
2024-02-06 10:30:08756browse

从 php 标准输入读取相当于什么?

Question content

I am transplanting a php script to listen to events of linux supervisor.

This may be a stupid question but I can't understand what this amounts to

$fin = fopen ("php://stdin","r");

I need this because when the supervisor fires an event, my script is also launched, and my script listens for events read from php://stdin


Correct answer


Read-only mode ("r") on fopen is PHP ignores the php:// handler .

Depending on what you want to do, you can use io.ReadAll(os.Stdin) or bufio.NewScanner(os.Stdin) (if you plan to read line by line ).

The above is the detailed content of What is the equivalent of reading from php standard input?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete