我正在开发一个带有php后端的iOS应用程序,我有一个php服务,它正在处理文件上传,我从互联网上获得了代码,但它不起作用。我试图通过使用print语句来调试它,但它没有打印任何东西到access.log,而是打印到屏幕上。有人能告诉我,如何打印输出访问。日志从php脚本。这里是php服务器-
<?php
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$userId = $_POST["userId"];
echo(var_dump($_POST));
$target_dir = "wp-content/uploads/2015/02";if(!file_exists($target_dir))
{
mkdir($target_dir, 0777, true);
}
$target_dir = $target_dir . "/" . basename($_FILES["file"]["name"]);
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_dir))
{
echo json_encode([
"Message" => "The file ". basename( $_FILES["file"]["name"]). " has been uploaded.",
"Status" => "OK",
"userId" => $_REQUEST["userId"]
]);
} else {
echo json_encode([
"Message" => "Sorry, there was an error uploading your file.",
"Status" => "Error",
"userId" => $_REQUEST["userId"]
]);
}
?>
你没有。Apache访问日志用于记录向Apache服务器发出的http/https请求。
根据你在哪个系统上运行Apache,"运行"Apache服务器的用户甚至没有对日志文件目录的权限,更不用说实际的日志文件了。
你到底想要完成什么?
希望你这样做是为了wordpress。您可以执行以下操作
file_put_contents(WP_CONTENT_DIR."/debug.log", print_r($_POST, 1), FILE_APPEND);
(Or) ref this
https://www.elegantthemes.com/blog/tips-tricks/using-the-wordpress-debug-log然后你可以查看存储在文件系统/app/wp-content/debug.log