Google Extension和PHP [英] Google Extension and PHP

查看:99
本文介绍了Google Extension和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屋!

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