// 스트림 설명자를 초기화합니다. $ descriptorspec = [ 0 =>
, // stdin 1 =>
, // stdout 2 =>, // stderr ]; // 명령을 실행합니다 $ process = proc_open ( './ test.sh', $ descriptorspec, $ pipes, dirname (__ file__), null); // 출력 스트림에서 읽습니다 $ stdout = stream_get_contents ($ pipes [1]); fclose ($ 파이프 [1]); $ stderr = stream_get_contents ($ pipes [2]); fclose ($ 파이프 [2]); // 결과를 출력합니다 echo "stdout : \ n"; var_dump ($ stdout); echo "stderr : \ n"; var_dump ($ stderr);
// Initialize stream descriptors $descriptorspec = [ 0 => ["pipe", "r"], // stdin 1 => ["pipe", "w"], // stdout 2 => ["pipe", "w"], // stderr ]; // Execute the command $process = proc_open('./test.sh', $descriptorspec, $pipes, dirname(__FILE__), null); // Read from the output streams $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); // Output the results echo "stdout:\n"; var_dump($stdout); echo "stderr:\n"; var_dump($stderr);
부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.
Copyright© 2022 湘ICP备2022001581号-3