file_put_contents("test.txt",json_encode($request).PHP_EOL,FILE_APPEND);

备注:可以使用file_get_content('text.txt');查看调试生成的文件