简体   繁体   中英

Execute C# application in PHP

I am new to PHP and I am trying to run ac# application I've developed, from my PHP project. The app is local and is on the same machine as the server.
I should only be able to execute the app (preferably run it in background), since it's output is printed in a separate file which I access in my website.

Is there any way to run the app from my website ? I've tried to use echo exec(...) but it won't work.

Use something like:

<?php
function _exec($cmd)
{
   $WshShell = new COM("WScript.Shell");
   $oExec = $WshShell->Run($cmd, 0,false);
   echo $cmd;
   return $oExec == 0 ? true : false;
}

_exec("yourprogram.exe");
?>

More info at: http://php.net/manual/en/function.exec.php

Also the user running the web server will need elevated permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM