javascript - 谷歌浏览器扩展不显示 PHP 代码
问题描述
我做了一个需要 PHP 的 Chrome 扩展
清单.json:
{
"manifest_version": 2,
"name": "Website Blocker",
"version": "1.0.1",
"description": "Website Blocker is an extension, Which allows you to block certain websites. It also Blocks Certain Websites based on your age. These information Will , be Sold and will be stored in a Hash Method for the best Security.",
"author": "Ryan Da Ghost",
"icons": {
"120": "blocker.png"
},
"browser_action": {
"default_icon": "blocker.png",
"default_title": "Website Blocker Settings",
"default_popup": "popup.php"
},
"permissions": ["activeTab", "tabs"],
"background": {
"scripts": ["main.js"]
}
}
弹出.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Website Blocker</title>
</head>
<body>
<h1>Website Hi</h1>
<hr />
<span><a href="" target="_blank">It seems You haven't Logged In!</a></span>
<?php echo "Hello world"; ?>
</body>
</html>
我看到一个返回值 NULL,我什么也没看到。有人可以告诉我发生了什么吗?
我怀疑 Google Chrome / Firefox / Edge 没有支持 PHP 代码的引擎。我很想解决这个问题,或者只是在后台看到这个问题,因为我需要连接到数据库并从他们那里获取数据。我可以返回一个值并在 JavaScript 代码中检查它。