What is the equivalent of reading from php standard input?

王林
Release: 2024-02-06 10:30:08
forward
778 people have browsed it

从 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");
Copy after login

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!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!