PHP:File_put_content不';不要创建文件

PHP:File_put_content不';不要创建文件,php,file-put-contents,Php,File Put Contents,这真的很奇怪,这段php代码在很长一段时间内运行良好 <?php header('Content-type: application/json'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $data = file_get_contents("php://input"); $arr = explode(' ',trim($data)); $file = $arr[0]; $my_file = "bet_shared/".$

这真的很奇怪,这段php代码在很长一段时间内运行良好

<?php
header('Content-type: application/json');

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
  $data = file_get_contents("php://input");
  $arr = explode(' ',trim($data));
  $file =  $arr[0];
  $my_file = "bet_shared/".$file;
  $sharing_bet = strstr($data," ");
  file_put_contents($my_file, $sharing_bet);
}
else
{
    var_export($_SERVER['REQUEST_METHOD']);
}
?>

现在,方法file\u put\u contents($my\u file,$sharing\u bet)不会在bet\u共享目录中创建文件。文件夹和目录中的所有权限都设置为777,所以另一个问题对我来说是无用的!我错过了什么想法吗?

最后我整理出: 该脚本是从android应用程序调用的,这是我创建连接和发布一些字符串的java代码

 URL url = new URL(URL_STRING);
                HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
                conn.setConnectTimeout(CONNECTION_TIMEOUT);
                conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
                //conn.setDoOutput(true);
                conn.setDoInput(true);
                conn.setUseCaches(false);
                conn.setRequestMethod("POST");
                conn.connect();

                OutputStream os = conn.getOutputStream();
                os.write(jsonBet.getBytes("UTF-8"));
                os.close();
我在下面添加了此代码:

                if (200 <= conn.getResponseCode() && conn.getResponseCode() <= 299) {
                    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                    Log.i("response = " , br.readLine());
                } else {
                    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
                    Log.i("response two = " , br.readLine());

                }

if(如果调用
var\u dump($my\u file);
var\u dump($sharing\u bet);
输出是什么?我放入var\u dump($sharing\u bet);文件放入内容($my\u file,$sharing\u bet);var\u dump($my\u file);第一个输出是我需要加载的字符串,第二个没有。因此
$my_file
是空字符串?如果
$my_file
是空字符串,则没有任何意义。