【发布时间】:2014-04-06 15:27:45
【问题描述】:
我最近使用www.acra.ch Exception Report library。
在 acra 网站上指出“您可以自己编写代码!” (经理)所以我想使用 php 文件在数据库中插入数据,但我找不到任何示例 PHP 脚本来获取发布的值,然后继续我的工作!
【问题讨论】:
标签: android debugging exception
我最近使用www.acra.ch Exception Report library。
在 acra 网站上指出“您可以自己编写代码!” (经理)所以我想使用 php 文件在数据库中插入数据,但我找不到任何示例 PHP 脚本来获取发布的值,然后继续我的工作!
【问题讨论】:
标签: android debugging exception
这是我使用的最简单的脚本。它将所有 POST 数据转储到一个以发生日期命名的文本文件中:
<?php
// Outputs all POST parameters to a text file. The file name is the date_time of the report reception
$fileName = date('Y-m-d_H-i-s').'.txt';
$file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
foreach($_POST as $key => $value) {
$reportLine = $key." = ".$value."\n";
fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
}
fclose($file);
?>
我大约 98.7% 确定这是他们在 ACRA 帮助网站上提供的 PHP 脚本(不记得我最初在哪里找到的)。
看看重要的东西:
foreach($_POST as $key => $value) {
$reportLine = $key." = ".$value."\n";
fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
}
如果您想以某种方式将其映射到数据库,上述 for-each 循环就是您获取键值对的方式。从那里,您应该能够确定要实际保存的内容。
【讨论】: