PHP无法以HTML呈现 [英] PHP not rendering in HTML

查看:77
本文介绍了PHP无法以HTML呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Windows 7与IIS 7一起使用.我正在尝试开始使用PHP.我已经执行了以下操作:

I am using Windows 7 with IIS 7. I am trying to get started with PHP. I have performed the following:

  1. 使用网络平台安装程序安装了PHP
  2. 通过在我的网站的根文件夹(全部在本地计算机上)的PHP管理器中使用检查phpinfo()"来验证是否已安装PHP

当我测试以查看PHP是否正在使用简单的HTML页面时,如下所示:

When I test to see if PHP is working with a simple HTML page as follows:

<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>  

</body>
</html>

Chrome不会呈现任何内容.我希望看到文字.

Chrome does not render anything. I am expecting to see the text.

有人可以告诉我如何继续吗?

Can anyone advise me how to proceed?

谢谢

推荐答案

如果出现此问题,请检查:

If this problem ocurrs check:

  • 文件是否具有扩展名 .php ?
  • 服务器上的路径是否正确 ?

重要的是要记住,我假设您有一台激活了php suport的服务器.在服务器上,PHP文件的默认扩展名是 .php ,但是您可以向管理员咨询以确保担保.

Its is important to remember that I am assuming that you have a server with php suport activated. On the server, the default extension to PHP files is .php, but you can check with the administrator to garantee.

您还可以检查错误日志是否已启用.禁用它,并且代码有语法错误时,屏幕上不显示任何内容.您可以在此处了解更多信息: https://stackoverflow.com/a/5438125/1735789

You can also check if the error log is enable. When it is disabled, and the code has a syntax error, nothing is showed on the screen. You can read more here: https://stackoverflow.com/a/5438125/1735789

这篇关于PHP无法以HTML呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆