[英]Unable to deploy static website to heroku, html and css not loading from php
所以我试图将 static 网站部署到 heroku 但主页没有加载 html/css 文件。
应用链接: https://randomstockpicker.herokuapp.com/
当我查看源代码时,它显示:
<?php include_once("home.html"); ?>
此 php 代码未加载“home.html”文件,该文件存在并且也已上传。
我也得到了 composer.json: {}
我按照本教程进行操作: https://medium.com/@agavitalis/how-to-deploy-a-simple-static-html-website-on-heroku-492697238e48
而不是使用:
<?php include_once("home.html"); ?>
这工作得很好
<?php include_once("./home.html"); ?>
您遵循的教程要求您将 index.html 文件重命名为自定义文件 (home.html),并使用 PHP 文件(这是一种服务器端脚本语言)来“加载”ZA81259CEF8E959C6247EDF1 文件。
它没有呈现页面,因为 Heroku 未配置为提供 PHP 文件。
I recommend you mv home.html index.html
(renaming you homepage back to index.html, which is a standard file that browsers look for) and you should see your static site.
Just as a side-note, PHP is not static, it's a dynamic scripting language, so if you're aiming at building a static site, avoid anything else than HTML + JS + CSS.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.