如何收集有关 PHP 应用程序中错误的客户端信息?
我正在使用 PHP 和 Yii 构建一个企业应用程序。我想要一种简单的方法让用户在发生问题或错误时报告问题或错误,但是我很难决定捕获/记录系统状态以帮助重复问题的最佳方法。
我一直在寻找一个集成所有内容的扩展或库,但可能不存在。否则我需要寻找一种方法来序列化 DOM 以供以后评估或类似的其他方法。
因此,用户可以单击“报告错误”按钮,该按钮捕获站点的状态并弹出一个弹出框,其中显示“发生了什么?”用户可以填写的文本框。
我可以选择哪些选项来执行此操作?
I'm putting together an enterprise application using PHP and Yii. I want an easy way for the users to report a problem or bug if one occurs however I'm having a difficult time deciding the best way to capture/record the state of the system to help duplicate the problem.
I was looking for an extension or library that integrates everything but that might not exist. Otherwise I need to look for a way to serialize the DOM for later evaluation or some other method like that.
So the user can click the "Report Bug" button which captures the state of the site and brings up a pop-up box with a "what happened?" text box the user can fill in.
What are my options to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 Airbrake(以前称为 Hoptoad)及其 php 通知程序。默认情况下,它们不会保存完整的 DOM 代码,但我认为您可以扩展通知程序来执行此操作。
要允许用户触发报告,您可以使用 ajax 加上自定义异常。
他们有免费的计划,而且设置非常容易。
Take a look at Airbrake (formerly known as Hoptoad) and its php notifier. By default they don't save full DOM code, but I think you can extend the notifier to do that.
To allow users to trigger reports you can use ajax plus a custom exception.
They have free plans and the setup is pretty easy to do.
要获取当前页面的 HTML 源代码,您可以使用以下 Javascript 代码片段:
您可能想要保存的另一条信息当然是当前 URL。您可以使用
jQuery.post
将所有这些发送到服务器,例如,如果没有某种可以调用的服务器端帮助程序,我认为您无法做更多的事情。您到底需要这个错误报告功能来实现什么功能?
To get the HTML source for the current page you can use this Javascript snippet:
Another piece of information you might want to save is of course the current URL. You can send all this to the server using
jQuery.post
, e.g.I don't think you can do more than that without some kind of server-side helper you can call to. What function exactly do you need this bug-reporting feature to fulfill?