echoo有什么问题 [英] What is wrong with echoo
本文介绍了echoo有什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
抱歉,我知道这是一个基本问题,但我已经尝试了几个小时,我似乎无法想到这有什么问题。
< pre lang =HTML> < !DOCTYPE html >
< html >
< ; 正文 >
< h1 > 我的第一个PHP页面< / h1 >
<? php echo < p> Hello World!< / p>< br>; ?>
< / body >
< / html >
输出结果。
我的第一个PHP页面
Hello World!
;?>
为什么';?>出现。
我尝试过:
<!DOCTYPE html>
< html>
< body>
< h1>我的第一个PHP页面< / h1>
<?php echo< p> Hello World!< / p>< br>
< / body>
< / html>
给出输出正确,但似乎根据w3schools语法是错误的。
解决方案
从PHP手册引用,
echo - 输出一个或多个字符串
描述
void echo(string
arg1 [,string
...])
输出所有参数。不附加额外的换行符。
echo实际上不是一个函数(它是一种语言结构),所以你不需要使用括号.echo(与其他语言结构不同) cts)的行为不像函数,所以它不能总是在函数的上下文中使用。另外,如果你想传递多个参数来回显,那么参数不能括在括号内。
我已经突出显示了关键的几个字。
sorry i know this is a basic question, but i have been trying for hours and i can't seem to think what is wrong with this.
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php echo "<p>Hello World!</p><br>";?>
</body>
</html>
the output gives.
My first PHP page
Hello World!
";?>
why ';?> appears.
What I have tried:
<!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo <p>Hello World!</p><br> </body> </html>
gives output correctly,but it seems that syntax is wrong according to w3schools.
解决方案
Quoting from the PHP manual,
echo — Output one or more strings Description void echo ( string
arg1 [, string
... ] ) Outputs all parameters. No additional newline is appended. echo is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo, the parameters must not be enclosed within parentheses.
I have highlighted the critical few words.
这篇关于echoo有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文