PHP 代码在 HTML 文件中不起作用,.htaccess 已配置,Dreamweaver PHP 服务器已设置,使用


php code not working inside html file, .htaccess configured,dreamweaver php server setted, using xampp

我无法在html文件上运行php脚本,如链接中的图片所示,它总是显示错误,html文件中没有任何功能。

但是我已经在网站根目录中配置了 .htaccess,我的 dreamweaver 有一个 php 本地服务器,我使用 xamppp 设置了我的 php。我不知道为什么它不起作用。

我的 .htaccess 文件:

AddHandler application/x-httpd-php .html .htm

AddType application/x-httpd-php5 .php5

AddType application/x-httpd-php5 .phps

AddType application/x-httpd-php5 .html .htm

图片在这里

正是@arif_suhail_123所说的。将索引.html文件重命名为索引.php并执行 PHP 代码。Apache不知道该文件包含PHP代码,如果.php文件扩展名不存在。