[英]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. 我是PHP的新手,我正在尝试从我的PHP项目中运行我开发的ac#应用程序。 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. 我试过使用
echo exec(...)
但它不起作用。
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 更多信息请访问: http : //php.net/manual/en/function.exec.php
Also the user running the web server will need elevated permissions. 运行Web服务器的用户也需要提升权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.