【发布时间】:2016-10-16 18:04:42
【问题描述】:
我正在开发一个带有 php 后端的 iOS 应用程序,我有一个处理文件上传的 php 服务,我从互联网上获得了代码,但它不工作。我正在尝试使用 print 语句对其进行调试,但它没有将任何内容打印到 access.log,而是打印到屏幕上。 有人可以告诉我,如何从 php 脚本打印输出到 access.log。这是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"]
]);
}
?>
【问题讨论】: