如何从Chrome书签运行PHP脚本? [英] How to run a PHP script from a Chrome bookmark?

查看:54
本文介绍了如何从Chrome书签运行PHP脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从Chrome浏览器书签中运行PHP脚本?我有一个PHP脚本,可以进行API调用并将我登录到特定的网站-而不是使用密码程序来记住我的用户名和密码,而我想使用该PHP脚本,因此我可以简单地单击它而不必输入任何文本.

is it possible to run a PHP script from a Chrome browser bookmark? I've got a PHP script that makes an API call and logs me in to a particular website- instead of using a password program to remember my username and password I want to use the PHP script so I can simply click on it and not have to enter any text.

这可能吗?

推荐答案

创建一个运行脚本的html文档,将其保存到磁盘上的某个位置,然后将其打开并添加书签.每次单击书签时,页面都会打开,并且脚本将像其他任何网页一样运行.

Create an html document that runs the script, save it to somewhere on your disk, then open it and bookmark it. Every time you click the bookmark the page will open and the script will be run like any other web page.

或者,您可以考虑自己编写一个扩展程序.如果您知道html和php甚至是一点点javascript,就足以造成一些损害.

Alternatively you can look into writing an Extension for yourself. If you know html and php and even a bit of javascript it will be enough to do some damage.

您应该能够进行扩展,以使用 sync 保存信息并登录,而无需在大约十分钟内打开新标签页.如果您已经知道html,php和/或javascript,唯一的障碍就是json清单,但是如果您知道,那么肯定可以造成一些损害.

You should be able to make an extension that saves information using sync and logs you in without opening a new tab in about ten minutes. The only hurdle if you already know html, php, and/or javascript will be the json manifest, but if you know that then you can certainly do some damage.

如果您有兴趣编写一个小型扩展程序,这就是我开始的地方:

If you are interested in writing a small extension, this is where i started:

https://developer.chrome.com/extensions/getstarted.html

您甚至可以让扩展程序打开您刚刚登录的页面,然后使扩展程序通过单击按钮或按键来隐藏其自身.扩展大部分是纯html和javascript.

You can even have the extension open the page you just logged into, then have the extension hide its self with the click of a button or the stroke of a key. Extensions are for the most part pure html and javascript.

要注意的一件事是,脚本必须与html分开完全,否则Chrome会停止运行,并且不会运行您的应用程序.这是针对javascript的相当简单的解决方法,从本质上讲,我的意思是说您想在按钮上附加 click 侦听器

One thing to note is that the scripts must be COMPLETELY separate from the html, otherwise Chrome will cry and not run your application. It's a fairly simple workaround for javascript, essentially what i mean is, say you wanted to attach a click listener on a button

<button id="foo" onclick="bar()"></button>

错了,但是您可以通过使用

Is wrong, but you can get around this by using

var button = document.getViewById("foo");
button.addEventListener("click", function() {});

在javascript中.这样,脚本便与html分开了,Chrome不会向您抱怨.

in javascript. In this way the script is separate from the html, and Chrome won't complain at you.

这篇关于如何从Chrome书签运行PHP脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆