PHP 渐进式 Web 应用程序未检测到清单
No Manifest Detected on a PHP Progressive Web Application
我正在尝试将我的 PHP Web 应用程序变成渐进式 Web 应用程序,但是当我打开 Chrome DevTools 进入应用程序选项卡时,它告诉我有 'No Manifest Detected'当我将 manifest.json 放在根目录但我的 ServiceWorker.js 成功 运行.
<!DOCTYPE html>
<html lang="en">
<?php
//php code
?>
<head>
<title>php</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
//body code
</body>
</html>
{
"name": "php",
"version": "1.0",
"short_name": "php",
"start_url": "./index.php",
"background_color": "#000000",
"display": "standalone",
"orientation": "any",
"default_locale": "en",
"description": "example",
"icons": [
{
"src": "512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]}
我已经在此处验证了 manifest.json 文件,它在测试 HTML 文件中有效;它只是试图将其放入 PHP 文件中,但我没有看到任何事情发生。
将您的 <head></head>
块直接移动到开始 <html>
标签下方,这样您的 <?php //php code ?>
就在它下面。如果文档头之前有任何输出,则不会检测清单。
<!DOCTYPE html>
<html lang="en">
<head>
<title>php</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<?php
//php code
?>
<body>
//body code
</body>
</html>
我正在尝试将我的 PHP Web 应用程序变成渐进式 Web 应用程序,但是当我打开 Chrome DevTools 进入应用程序选项卡时,它告诉我有 'No Manifest Detected'当我将 manifest.json 放在根目录但我的 ServiceWorker.js 成功 运行.
<!DOCTYPE html>
<html lang="en">
<?php
//php code
?>
<head>
<title>php</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
//body code
</body>
</html>
{
"name": "php",
"version": "1.0",
"short_name": "php",
"start_url": "./index.php",
"background_color": "#000000",
"display": "standalone",
"orientation": "any",
"default_locale": "en",
"description": "example",
"icons": [
{
"src": "512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]}
我已经在此处验证了 manifest.json 文件,它在测试 HTML 文件中有效;它只是试图将其放入 PHP 文件中,但我没有看到任何事情发生。
将您的 <head></head>
块直接移动到开始 <html>
标签下方,这样您的 <?php //php code ?>
就在它下面。如果文档头之前有任何输出,则不会检测清单。
<!DOCTYPE html>
<html lang="en">
<head>
<title>php</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<?php
//php code
?>
<body>
//body code
</body>
</html>