且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在html文件中运行php脚本?

更新时间:2023-02-22 20:23:47

不能在 结尾 .html 的HTML页面中运行 PHP >。除非页面实际上是PHP,并且扩展名已被 .htaccess $ c>从 .php 更改为 .html

You can't run PHP in an html page ending with .html. Unless the page is actually PHP and the extension was changed with .htaccess from .php to .html

你的意思是:

What you mean is:

index.html
<html>
...
<?php echo "Hello world";?> //This is impossible


index.php //The file extension can be changed using htaccess, ex: its type stays php but will be visible to visitors as index.html

<?php echo "Hello world";?>