Skip to content

Instantly share code, notes, and snippets.

@fasthold
Created July 2, 2014 07:17
Show Gist options
  • Save fasthold/3deb4ac26becb1b2aec6 to your computer and use it in GitHub Desktop.
Save fasthold/3deb4ac26becb1b2aec6 to your computer and use it in GitHub Desktop.
PHP执行shell捕获输出
<?php
if ( $res = popen("ls 2>&1","r")){
while ( !feof($res) ) $result .= fgets( $res, 1024 );
pclose($res);
echo $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment