php新手,回声不起作用? [英] Php Newbie, echo not working?

查看:74
本文介绍了php新手,回声不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,这几乎绝对是一个新手问题,但是我正在学习php上的w3教程,在我的服务器上,有时我只能得到echo的帮助。

So this is almost definitely a newbie question, but I'm going through the w3 tutorial on php and on my server I can only get echo to work sometimes.

例如,在一个试验中,他们让我以一种形式提交输入,然后以另一种形式进行输入,在这种情况下,echo起作用,但是在此代码中,它不会:

For example in one trial they have me submitting inputs in one form and picking them up in another, and echo works in that case, but in this code it won't:

<html>
<body>

<p>
This should work!! <?php
$str = "Hello, World!";
echo $str; 
?>
It failed...
</p>

</body>
</html>

输出应为:这应该有效!!你好,世界!它失败了... 但是它只返回了,这应该可以工作!失败了……,当我看到它时进入了html页面。

The output should just be: This should work!! Hello, World! It failed... But instead it just returns This should work!! It failed..., to the html page when I look at it.

关于如何使它起作用的任何想法?

Any ideas on how I could possibly get this to work?

推荐答案

我想您忘了让文件名以 .php

I suppose that you have forgotten to let the filename end with .php.

所以<(?php)( ?)> 被解释为html标记,因此不可见。查看原始的html输出,然后您可能会注意到发生了什么。

So everything between the <(?php) and the (?)> is interpreted as a html tag and not visible. See your raw html output, then you may notice what's going on.

这篇关于php新手,回声不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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