PHP範例
<?php $answer = shell_exec("exe\AplusB.exe 1.3 2.5"); //路徑要用 反斜線 啊 windows echo $answer."</br>"; ?>
C++ 範例 (AplusB.exe):二個數值相加
#include <stdlib.h>
int main(int argc, char* argv[]) { if (argc <= 1) return -1; double a = atof(argv[1]); double b = atof(argv[2]); printf("%lf + %lf = %lf\n", a, b, a + b); return 0; }
PHP執行結果:
1.300000 + 2.500000 = 3.800000
[Reference]
https://stackoverflow.com/questions/12251634/how-to-run-abc-exe-using-php
http://eeepage.info/php-system-exec-passthru/
No comments:
Post a Comment