如何显示(测试).php文件(how to display (test) .php file)

编程入门 行业动态 更新时间:2024-10-11 07:31:00
如何显示(测试).php文件(how to display (test) .php file)

我开始通过自己学习php,例如我有这个代码,假设显示“Hello World”

<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>

我把它保存为hello.php,但是当我用Firefox打开它时它显示如下:

Hello World '; ?>

有人可以帮我解释一下吗?

I'm begin to learn php by my self, for example I have this code,suppose to disply "Hello World"

<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>

I save it as hello.php, but when I open it by Firefox it display like that:

Hello World '; ?>

can somebody explain for me?

最满意答案

恭喜开始使用php。 您将需要一个Web服务器来运行PHP。 Firefox可以处理HTML,CSS和Javascript标记/代码以输出网页但无法处理。 它是服务器端语言,你需要某种服务器才能做到这一点。

如果你有一台Windows PC,最简单的方法,至少对我来说,将是XAMPP / WAMP或类似的软件。 您可以在维基百科中找到一个很好的比较图表。

您可以使用以下语法清理代码。

<html> <head> <title>PHP Test</title> </head> <body> <p><?php echo 'Hello World'; ?></p> </body> </html>

我认为看起来整洁:)

Congratulations on getting started with php. You will need a web server to run PHP. Firefox can process HTML, CSS and Javascript markup/codes to output the web page but it can't process. It's a server side language and you will need some sort of server to do that.

If you have a Windows PC, the easiest way, at least for me, would be XAMPP/WAMP or similar software. You can find a good comparison chart in Wikipedia.

You can make the code clean with following syntax.

<html> <head> <title>PHP Test</title> </head> <body> <p><?php echo 'Hello World'; ?></p> </body> </html>

looks neat I think :)

更多推荐

本文发布于:2023-08-07 16:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465335.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   测试   php   file   display

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!