package main import ( "os/exec" "fmt" ) func main() { var( cmd *exec.Cmd output []byte err error ) cmd = exec.Command("D:\\phpStudy\\PHPTutorial\\php\\php-5.6.27-nts\\php.exe","-m") if output,err = cmd.CombinedOutput();err !=nil{ fmt.Println(err) return } fmt.Println(string(output)) }
GOROOT=D:\go #gosetup GOPATH=D:\gospace;C:\Users\Administrator\go #gosetup D:\go\bin\go.exe build -i -o C:\Users\Administrator\AppData\Local\Temp\___go_build_main_go__4_.exe D:/gospace/src/gocode/test/main.go #gosetup D:\soft\GoLand\bin\runnerw.exe C:\Users\Administrator\AppData\Local\Temp\___go_build_main_go__4_.exe #gosetup [PHP Modules] bcmath bz2 calendar Core ctype curl date dom ereg filter ftp gd hash iconv json libxml mbstring mcrypt mhash mongodb mysql mysqli mysqlnd odbc openssl pcre PDO pdo_mysql pdo_sqlite Phar Reflection session SimpleXML SPL sqlite3 standard tokenizer wddx xml xmlreader xmlwriter xsl Zend Guard Loader zip zlib [Zend Modules] Zend Guard Loader Process finished with exit code 0
原文:https://www.cnblogs.com/sunlong88/p/11285673.html