【发布时间】:2016-12-17 01:25:54
【问题描述】:
我正在尝试创建一个 WebServer,它使用 HTML、图像... 但是我想实现 PHP,并且我有一个 PHP-CGI 的工作实现,但它不适用于像“file_get_contents”和 cookie 这样的东西。 我想知道是否有办法解决这个问题?
private string ProcessPHP(string phpPath, CookieCollection cookies)
{
Process CGI = new Process();
CGI.StartInfo.FileName = "php\\php.exe";
CGI.StartInfo.CreateNoWindow = true;
CGI.StartInfo.Arguments = "-q \"" + phpPath + "\"";
CGI.StartInfo.RedirectStandardOutput = true;
CGI.StartInfo.UseShellExecute = false;
CGI.Start();
string OutputText = CGI.StandardOutput.ReadToEnd();
CGI.WaitForExit();
CGI.Close();
return OutputText;
}
我知道我没有对 CookieCollection 做任何事情,但我想知道如何使用它。
谢谢!
【问题讨论】: