Google Extension和PHP [英] Google Extension and PHP
问题描述
是否可以在Google Extension中包含PHP文件?如果是这样,我该怎么做?
这是我的清单:
{
name:我的第一个扩展名,
version:0.1,
description:我的第一个扩展名,
content_scripts :[
{
匹配:[http://jquery.com/*],
js:[jquery.js,content.js ]
}
],
browser_action:{
default_icon:logo.png,
popup:index.html
$,
permissions:[
http://api.flickr.com/
]
}
所以我有jQuery包含,它似乎工作,所以在我的index.html我有这个javascript:
var html = $ .ajax({
url:ajax.php,
async:false
})。responseText ;
有没有办法包含ajax.php并查询它?
这是我的第一个,如果这是一个简单的问题,请原谅我,但Google似乎没有在这个问题上提出任何主题,
感谢!
解决方案您可以将php文件放入扩展文件夹并从javascript读取文本文件),但不能运行该php代码。
Is it possible to include a PHP file inside a Google Extension? If so, how do I do it?
Here's my manifest:
{ "name": "My very first extension", "version": "0.1", "description": "My first extension", "content_scripts": [ { "matches": ["http://jquery.com/*"], "js": ["jquery.js", "content.js"] } ], "browser_action": { "default_icon": "logo.png", "popup" : "index.html" }, "permissions": [ "http://api.flickr.com/" ] }
So I have jQuery included and it seems to be working, so in my index.html I have this javascript:
var html = $.ajax({ url: "ajax.php", async: false }).responseText;
Is there a way to include ajax.php and query it?
This is my first one, forgive me if this is a simple problem, but Google doesn't seem to produce any topics on this one,
Thanks!
解决方案You can put php file into extension folder and read it from javascript as a text file (from a background page), you can't run that php code though.
这篇关于Google Extension和PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!