如何使用 php 拍摄当前浏览器窗口的快照

发布于 2024-07-29 23:38:01 字数 50 浏览 6 评论 0原文

我尝试到处搜索,但除了让客户端使用文件(某种批处理/exe)之外,似乎没有可用的实现。

I've tried searching everywhere but there's seems to be no implementation available other than having the client use a file (batch/exe of some sort).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

过潦 2024-08-05 23:38:02

我假设你指的是一般意义上的“你的”。 如果您的意思是“如何截取屏幕截图...”,您通常会按打印屏幕键。 如果您试图捕获用户的浏览器输出,我想说这可能是不可能的。 如果是的话,你能得到的最好的结果就是你自己写的输出。

如果您可以使用 JS 模拟打印屏幕按键并将文件保存到 Gears 可以访问的位置,Google Gears 可能会被黑客攻击做一些类似的事情。

I'm assuming you mean "your" in the general sense. If you mean "how does one take a screenshot...", you generally hit the print screen key. If you're trying to capture your users' browser output, I'd say that it's probably not possible. If it were, the best you could get is the output of what you wrote yourself.

Google Gears might be hackable to do something close, if you can simulate the print screen key press with JS and get the file to save somewhere gears can access.

去了角落 2024-08-05 23:38:02

您无法在 PHP 中执行此操作,因为 PHP 运行在服务器上,而不是客户端上。

要获取浏览器的屏幕截图,您可以查看此列表

如果您正在寻找一种自动化解决方案来截取浏览器窗口中打开的网页的屏幕截图,您还可以查看这个问题:如何使用 PHP、shell_exe 和 scrot 捕获 x 屏幕及其答案。

最后,在不选择任何特定帖子的情况下,您可以尝试搜索 SO ; 像屏幕截图浏览器之类的东西,按相关性排序,似乎得到了一些有趣的帖子:- )

祝你好运!

You can't do that in PHP, as PHP is running on the server, and not the client.

To get screenshots of the browser, you can take a look at, for instance, this list.

If you are look for an automated solution to take screenshot of web pages opened in a browser window, you could also look at this question : How to capture x screen using PHP, shell_exe and scrot and it's answers.

And, finally, and without selecting any particular post, you can try a search on SO ; something like screenshot browser, sorted by relevance, seems to get some interesting posts :-)

Good luck !

豆芽 2024-08-05 23:38:01

你就是做不到。 PHP 是服务器端脚本语言,也许你可以使用 JavaScript 来做到这一点,但我什至不确定。

我知道有人实现了这样的服务,但实际上他必须使用Mozilla浏览器,打开一个脚本(我认为它不是JS,可能是perl,c/c++)截屏并上传。

You just can't do it. PHP is server side scripting language, maybe you can do that using JavaScript, but I'm not even sure about that.

I know someone implemented such service, but actually he had to use Mozilla browser, which opened, a script (I think it was not JS, maybe perl, c/c++) made a screenshot and uploaded it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文