[英]Code structuring - How to include a file (JS, PHP, etc...) into HTML
你好吗?
我想尽可能仔细地构建我的代码,但我不知道该怎么做。 在单个文件中,我有 PHP、JS 和 HTML 代码,我想知道是否可以通过在 html 代码中包含它们的“路径”来分隔内容。
例如,我如何将 php 代码和 js 代码分开:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{ js code }
{ php code }
</body>
</html>```
Thank you in advance for the information I would receive
您可以使用“.php”文件作为默认文件,然后将 html 放入其中
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="file.js"></script>
<?php include('file.php') ?>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.