是否有任何原因导致.php文件会被远程回发命中,而MVC操作不会';不会吧?
我在windows服务器上有两个脚本,设置为从post接收数据 一个是可以工作的PHP文件是否有任何原因导致.php文件会被远程回发命中,而MVC操作不会';不会吧?,php,asp.net,asp.net-mvc,post,postback,Php,Asp.net,Asp.net Mvc,Post,Postback,我在windows服务器上有两个脚本,设置为从post接收数据 一个是可以工作的PHP文件 <?php echo "Hello! <br/> This is a Post Back script that writes to a text file!"; // retrieving information from Post Back $accounting = $_POST["accountingAmount"]; $accounting_txt
<?php
echo "Hello! <br/> This is a Post Back script that writes to a text file!";
// retrieving information from Post Back
$accounting = $_POST["accountingAmount"];
$accounting_txt = "accounting: " . "$accounting" . "\n\n";
$address1 = $_POST["address1"];
// LOTS MORE FIELDS //
$address1_txt = "address1: " . "$address1" . "\n\n";
"$recurPrice_txt" . "$referer_txt" . "$referringUrl_txt" . "$reservationId_txt" . "$responseDigest_txt" . "$start_date_txt" . "$state_txt" . "$sub_id_txt" . "$typId_txt" . "$username_txt" . "$zipcode_txt";
// write to a text file
$myFile = "postback.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $message;
fwrite($fh, $stringData);
fclose($fh);
?>
我通过将vs放在服务器上并设置断点进行测试,操作甚至没有启动
是否有任何原因导致.php文件会被远程回发命中,但MVC操作不会被命中?php脚本没有任何HTTP方法保护-它将在GET或POST请求中运行,而MVC引擎仅在响应POST请求时启动
approved
方法(因为您有[HttpPost]
属性)。我猜你只是用你的web浏览器(总是会发出GET请求)点击服务器,而不是用工具创建POST请求。谢谢,但我肯定是用POST点击的。现在,我在使用straight.aspx文件时遇到了同样的问题,因此旅程将继续进行调用phpinfo()时会发生什么代码>?这是一个更具体的新问题。您可以看到请求击中服务器,然后返回500。
[HttpPost]
public ActionResult approved(FormCollection formValues)
{
var context = new LSmixDbEntities();
PaymentHistory ph = new PaymentHistory();
StringBuilder s = new StringBuilder();
foreach (string key in Request.Form.Keys)
{
s.AppendLine(key + ": " + Request.Form[key] + Environment.NewLine);
}
string formData = s.ToString();
//save formData in db
}