学习php。使用easyphp和在记事本中书写,Hello world不会显示++

发布于 2024-09-08 17:50:39 字数 464 浏览 2 评论 0原文

<html>

<!--HTML-->
<head><title>a quick test</title></head>
<body>a quick test</body>

<p>javascript</p>

<!--javascript-->
<p><script>
document.write("hello world")
</script></p>

<p>php</p>

<!--php-->
<?php
Echo "hello world";
?>

</html>

Hello world 适用于 javascript,但不适用于 php,这是怎么回事?有什么建议或明显的错误吗?

谢谢

<html>

<!--HTML-->
<head><title>a quick test</title></head>
<body>a quick test</body>

<p>javascript</p>

<!--javascript-->
<p><script>
document.write("hello world")
</script></p>

<p>php</p>

<!--php-->
<?php
Echo "hello world";
?>

</html>

The Hello world works for javascript but not in php, what gives? Any suggestions or obvious errors?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

蓝戈者 2024-09-15 17:50:39

您是否使用 .php 文件扩展名保存此文件? PHP 代码不会在普通的 .html 文件中执行。

Are you saving this file with a .php file extension? PHP code will not execute within a normal .html file.

半暖夏伤 2024-09-15 17:50:39

如果你查看源代码,你能读懂你的 PHP 吗?
可能是你的环境设置错了。

产量?

If you view source, can you read your PHP?
Perhaps your environment is set up wrong.

What does <?php phpinfo(); ?> yield?

太阳男子 2024-09-15 17:50:39

顺便说一句,要使 w3 有效,您的 body 标记应该在结束 html-tag -> 之前结束。像这样:

<body>a quick test

<p>javascript</p>

<!--javascript-->
<p><script>
document.write("hello world")
</script></p>

<p>php</p>

<!--php-->
<?php
Echo "hello world";
?>

</body>

</html>

To be w3 valid by the way, your body tag should end before the ending html-tag -> as such:

<body>a quick test

<p>javascript</p>

<!--javascript-->
<p><script>
document.write("hello world")
</script></p>

<p>php</p>

<!--php-->
<?php
Echo "hello world";
?>

</body>

</html>
泪意 2024-09-15 17:50:39

首先,在保存任何与 PHP 相关的文件之前,您必须清楚地了解它将以哪种格式保存。将文件保存为.php扩展名,例如:filename.php,然后在WAMP服务器上执行它。你会发现HELLO World。

First of all, before saving any file related to PHP, You have to clear see in which format it is going to Save. Save the file in .php extension, for example : filename.php then execute it at WAMP server. You will find HELLO World.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文