2013年1月7日 星期一

PHP run executable file in the xampp of Windows

There is the document talk about this -- http://php.net/manual/en/function.exec.php
<?php function execInBackground($cmd) {
    if (
substr(php_uname(), 07) == "Windows"){
        
pclose(popen("start /B "$cmd"r")); 
    }
    else {
        
exec($cmd " > /dev/null &");  
    }
?> 

And there is also another document talk about this -- http://www.somacon.com/p395.php.  In this document , it provide many methods to do this.  And after my try,   pclose(popen("start /B ". " c:\\new\\New2.bat", "r")); is workable.


For more information, you can check http://php.net/manual/en/function.popen.php.

沒有留言:

張貼留言