浏览器显示 PHP 代码而不是处理它
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13241738/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Browser is showing PHP code instead of processing it
提问by FarrisFahad
Possible Duplicate:
PHP code is not being executed (i can see it on source code of page)
web browser not processing PHP code as PHP code
I have installed XAMPP on my computer which is Windows 8 pro. I use to work with Windows 7
every time I run the index.phpfile on Windows 8 it shows the code on the browser IE10.
我已经在我的 Windows 8 pro 计算机上安装了 XAMPP。每次我index.php在 Windows 8 上运行该文件时,我都会使用 Windows 7,它会在浏览器 IE10 上显示代码。
Here is what I have done:
这是我所做的:
- I have named the file correctly:
index.php - I have installed the server and saved the files inside
c:/xampp/htdocs/PHP/ - I have used
<?php ?>to open and close all PHP tags and everything else seems working fine, like, PHPMyAdmin, and the php.ini file
- 我已正确命名文件:
index.php - 我已经安装了服务器并将文件保存在里面
c:/xampp/htdocs/PHP/ - 我曾经
<?php ?>打开和关闭所有 PHP 标签,其他一切似乎都运行良好,例如 PHPMyAdmin 和 php.ini 文件
I don't know whats wrong and it is driving me crazy ...
我不知道出了什么问题,这让我发疯......
Farris
法里斯
回答by
The problem is you're not parsing the file via the web server, but accessing it directly.
问题是您不是通过 Web 服务器解析文件,而是直接访问它。
you need to use the url:
您需要使用以下网址:
http://localhost/index.php
or maybe (based on your path above) its
或者(根据你上面的路径)它的
http://localhost/PHP/index.php
in the browser
在浏览器中

