为什么VB.NET无法执行进程?

时间:2016-01-08 13:10:19

标签: php vb.net

我制作了一个快速简单的vb.net应用程序,允许用户输入文本,单击按钮,将该文本发送到php脚本,并在消息框中显示响应。问题是,当我使用$(document).on('click', '#nextTipButton', fn); 启动我的php进程时,它给我一个Windows异常,无法找到该文件。所以我检查了,文件在我的电脑上。有没有人知道为什么它不起作用?

这是我的VB.NET代码:

php.start()

我不确定它会有所帮助,但这是我的PHP脚本:

Imports System.IO
Public Class frmPHP
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles btnSubmit.Click
    Dim php As New Process()
    Dim phpinfo As New ProcessStartInfo("php", "script.php " + txtInput.Text)
    Dim response As String = ""
    phpinfo.UseShellExecute = False
    phpinfo.RedirectStandardOutput = True
    php.StartInfo = phpinfo
    php.Start() //This is where it errors
    Using phpreader As StreamReader = php.StandardOutput
        response = phpreader.ReadLine()
    End Using
    MsgBox(response)
End Sub
End Class

0 个答案:

没有答案