如何解决从PHP调用Powershell脚本
我有一个通过使用php传递两个数组参数来调用powershell脚本的代码。但是当我调用该函数时,它没有将值返回给UI
<form method="post" action="Index.php">
<input type="submit" id="submit" name="submit" class="btn btn-info" onClick="CallPowershell" value="Generate Report" />
</form>
以下方法用于调用Powershell脚本
if(isset($_POST['submit'])){
echo shell_exec('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe C:\\Users\\CallPower.ps1');
}
这是Powershell脚本(CallPower.ps1)
New-Item C:\Users\test.txt
Set-Content C:\Users\test.txt 'Welcome to TutorialsPoint'
在这里,我在UI中打印了所有VMName。但是它什么也没显示。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com(将#修改为@)