很抱歉,如果有足够的答案,但我尝试了每一个答案。 我有一个网站(http://grmpixelmon.co/hwidreplace.html) 有HWID标签,在文本文件中输入要替换的HWID(HWIDs.txt) 但它一直给我错误500 .. 这是我试过的代码
<?php
// See the password_hash() example to see where this came from.
$hwid = $_POST['hwid'];
$FILE = "HWIDs.txt";
$replace = $_POST['replace'];
$replace_with = " ";
$password = $_POST['password'];
$password2 = 'mypassword';
if ($password2 === $password) {
if ( empty ($hwid) ){
echo 'you did not enter an hwid';
}else{
file_put_contents("HWIDs.txt", $hwid, FILE_APPEND);
echo 'Succesfully added ';
echo $hwid;
echo ' as hwid';
}
$data = file_get_contents("HWIDs.txt");
$newdata = str_replace($replace, $replace_with, $data);
file_put_contents("HWIDs.txt", $newdata);
}
}
} else {
echo 'Invalid password.';
}
?>
答案 0 :(得分:0)
除非您在帖子中没有包含更多代码,否则花括号不平衡 - 打开和关闭的简单计数或正确的代码缩进显示了这一点。
$hwid = $_POST['hwid'];
$FILE = "HWIDs.txt";
$replace = $_POST['replace'];
$replace_with = " ";
$password = $_POST['password'];
$password2 = 'mypassword';
if ($password2 === $password) {
if ( empty ($hwid) ){
echo 'you did not enter an hwid';
}else{
file_put_contents("HWIDs.txt", $hwid, FILE_APPEND);
echo 'Succesfully added ';
echo $hwid;
echo ' as hwid';
}
$data = file_get_contents("HWIDs.txt");
$newdata = str_replace($replace, $replace_with, $data);
file_put_contents("HWIDs.txt", $newdata);
} else {
echo 'Invalid password.';
}