代码如下。 这个问题在这篇文章的标题上解释了....
<?php
$filenumber = $_POST['filenumber'];
$file = 'view/$filenumber.txt';
$sharedfile = 'view/$shared.txt';
if(!isset($filenumber) || trim($filenumber) == '')
{
echo "The file number field is empty or #$filenumber does not exist. Redirecting you in 3 seconds.";
header ( "refresh:3;url=https://2.survivaltimepe.com" );
exit;
}
$shared = $_POST['shared'];
if(!isset($shared) || trim($shared) == '')
{
echo "The shared number field is empty or #$shared does not exist. Redirecting you in 3 seconds.";
header ( "refresh:3;url=https://2.survivaltimepe.com" );
exit;
}
$file = view/$filenumber.txt;
if (file_exists($file)) {
echo "";
} else {
echo "The field is empty or the #$filenumber file number does not exist. Redirecting you in 3 seconds.<br>";
}
$sharedfile = view/$shared.txt;
if (file_exists($sharedfile)) {
echo "";
} else {
echo "The field is empty or the #$shared shared number does not exist. Redirecting you in 3 seconds.";
header ( "refresh:3;url=https://2.survivaltimepe.com" );
exit;
}
$file = "view/$filenumber.txt";
unlink($file);
$sharedfile = "view/$shared.txt";
unlink($sharedfile);
echo ("File #$filenumber has been successfully removed.<br>Remember that you can always create a new link on the site.<br><br>Redirecting you in 10 seconds.");
header( "refresh:10;url=https://2.survivaltimepe.com" );
?>
标题解释了它显示变量的大部分内容,而不是它应该是view / thehtmlformpostnumberhere.txt
答案 0 :(得分:0)
将$file = 'view/$filenumber.txt';
更改为$file = 'view/'.$filenumber'.'.txt';
更新:
我在你的剧本中看到你有更多这种情况。在字符串中使用变量时,请使用'.$variable.'