Php 从ANDROID向WEB服务器发送数据
我的应用程序必须扫描二维码并将结果(字符串)发送到Web服务器,因为我想在我的网页上可视化它。在我的php页面中,我把这个Php 从ANDROID向WEB服务器发送数据,php,android,post,Php,Android,Post,我的应用程序必须扫描二维码并将结果(字符串)发送到Web服务器,因为我想在我的网页上可视化它。在我的php页面中,我把这个 <?php // get the "message" variable from the post request // this is the data coming from the Android app $message=$_POST["message"]; // specify the file where we
<?php
// get the "message" variable from the post request
// this is the data coming from the Android app
$message=$_POST["message"];
// specify the file where we will save the contents of the variable message
$filename="androidmessages.html";
// write the data to the file
file_put_contents($filename,$message,FILE_APPEND);
// load the contents of the file to a variable
$androidmessages=file_get_contents($filename);
// display the contents of the variable (which has the contents of the file)
echo $androidmessages; ?>
但我想象的是一个空白页!!!为什么?开始检查文件内容()的返回值。然后看一下其他文件。。。。标志。可能是因为您没有在
$\u POST['message']
字段中发送任何内容。不,我发送了一些内容,因为使用FILE\u APPEND,我可以在我的网页上显示扫描结果!
file_put_contents($filename,$message);