b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

phpecho_echo php用法_phpecho跳转页面

电脑杂谈  发布时间:2017-04-28 00:05:39  来源:网络整理

Pay attention to this part of the documentation:

echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function

I was trying to make certain that I was detecting errors and was trying code like this:

@alwaysFails() or echo('Surprise! It failed again');

This error was generated:

[29-Jul-2011 12:56:19] PHP Parse error: syntax error, unexpected T_ECHO in /Applications/MAMP/test.php on line 12

Changing to die(), print() or a function I defined worked fine. Beware of this limitation of echo.

A way to color your echo output is to use shell_exec and the echo command (this only works on Linux/bash) in the following way:

<?php

echo shell_exec('echo "e[0;31m Red color e[0;32mGreen color e[0m No color "');

?>

See for more colors and other options.

Outputting won't generate a line break in the browser, <br /> is required for line break. Also,

<?php

echo "first line";

echo "second line";

?>

will like

first linesecond line

because you didn't insert spaces/line breaks.

the echo function can also be written like

<?php

echo ('text here')

?>

hemanman at gmail dot com, the problem is that func() doesn't actually return a value (string or otherwise), so the result of echoing func() is null.

With the comma version, each argument is evaluated and echoed in turn: first the literal string (), then func(). Evaluating a function call obviously calls the function (and in this case executes its own internal echo), and the result (null) is then echoed accordingly. So we end up with "outside func() within func()" as we would expect.


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-43880-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...