好日子讓PHP輸出
,我們使用的是C#MVC的網頁的工作,我們在取得PHP輸出到顯示器上的MVC網頁的製作。我們在php中創建了1個頁面,文件名爲「hello.php」,它顯示「hello word」
我們已經將調用頁面的代碼放在usercontrol中,但是當它放在site.master廣告運行中時它給我們hello.php而不是「你好世界的代碼。
我們的用戶控件的代碼如下
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string file = Server.MapPath("Hello.php");
StreamReader sr;
FileInfo fi = new FileInfo(file);
string input = "";
if (File.Exists(file))
{
sr = File.OpenText(file);
input += Server.HtmlEncode(sr.ReadToEnd());
sr.Close();
}
Response.Write(input);
}
</script>
希望任何人的響應