谷歌扩展和PHP

时间:2011-02-02 18:40:50

标签: php google-chrome-extension

是否可以在Google扩展程序中包含PHP文件?如果是这样,我该怎么做?

这是我的清单:

{
  "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/"
  ]
}

所以我有jQuery包含它似乎工作,所以在我的index.html我有这个javascript:

var html = $.ajax({
  url: "ajax.php",
  async: false
 }).responseText;

有没有办法包含ajax.php并查询它?

这是我的第一个,如果这是一个简单的问题,请原谅我,但谷歌似乎没有在这个问题上产生任何主题,

谢谢!

1 个答案:

答案 0 :(得分:3)

你可以将php文件放入扩展文件夹并从javascript中读取它作为文本文件(从后台页面),但你不能运行那个php代码。