Php Web服务器上的转换应用程序一直超时
这将有很多解释,但我有一个通过ubuntu设置的Web服务器,我目前有一个html表单设置为:Php Web服务器上的转换应用程序一直超时,php,html,Php,Html,这将有很多解释,但我有一个通过ubuntu设置的Web服务器,我目前有一个html表单设置为: <form action="Converter.php" method="post" enctype="multipart/form-data" style="font-family: verdana" target="_blank"> <input type="file" name="userfile" style="font-family: verdana
<form action="Converter.php" method="post" enctype="multipart/form-data" style="font-family: verdana" target="_blank">
<input type="file" name="userfile" style="font-family: verdana">
<input type="submit" style="font-family: verdana">
</form>
<?php
$InputFile = $_FILES['userfile'];
$Input = fread($InputFile, filesize("$InputFile"));
$SearchVals = ["location /", " { add_header X-Redirect-By \"Yoast SEO Premium\"; return 301 ", "/; }", "; }"];
$ReplaceVals = ["rewrite ^\/", "\\/?$ /", " permanent;", "/ permanent;"];
$Input = str_replace($SearchVals, $ReplaceVals, $Input);
$Input = str_replace("/https:", "https:", $Input);
$Index = strpos($Input, "https:");
$Endex = strpos($Input, ".com");
$Str = substr($Input, $Index, $Endex - $Index + strlen($Endex) + 1);
echo $Input;
?>
这意味着通过表单接受用户给定的文本文件,重写其中的文本,并将其发布到新选项卡,供用户下载或复制/粘贴。当前converter.php设置为:
<form action="Converter.php" method="post" enctype="multipart/form-data" style="font-family: verdana" target="_blank">
<input type="file" name="userfile" style="font-family: verdana">
<input type="submit" style="font-family: verdana">
</form>
<?php
$InputFile = $_FILES['userfile'];
$Input = fread($InputFile, filesize("$InputFile"));
$SearchVals = ["location /", " { add_header X-Redirect-By \"Yoast SEO Premium\"; return 301 ", "/; }", "; }"];
$ReplaceVals = ["rewrite ^\/", "\\/?$ /", " permanent;", "/ permanent;"];
$Input = str_replace($SearchVals, $ReplaceVals, $Input);
$Input = str_replace("/https:", "https:", $Input);
$Index = strpos($Input, "https:");
$Endex = strpos($Input, ".com");
$Str = substr($Input, $Index, $Endex - $Index + strlen($Endex) + 1);
echo $Input;
?>
但是当我提交表单时,它会将我带到一个新选项卡,并继续超时,而不会在超时之外给我另一个错误。fread根据需要一个句柄,要做到这一点,您需要使用fopen查看文档中的示例。因为您没有打开文件,所以无法读取它,$Input开始为空,结束为空
当您回显一个空字符串时,不会显示任何内容,因此这就是为什么您会得到一个空白选项卡。至于它在另一个选项卡中打开,这就是target=\u blank的工作方式,它在一个新的空白选项卡中打开
除此之外,通常如果您进入托管web服务器的任何位置,都可以查看PHP错误日志。这通常有助于让我们知道出了什么问题