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

phpecho_echo php用法_phpecho跳转页面(2)

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

Thus:

<?php

echo "outside func ()", func ();

?>

effectively becomes:

<?php

echo "outside func ()";

//func ()

{

echo "within func ()";

}

echo '';

?>

The dot version is different: there's only one argument here, and it has to be fully evaluated before it can be echoed as requested. So we start at the beginning again: a literal string, no problem, then a concatenator, then a function call. Obviously the function call has to be evaluated before the result can be concatenated with the literal string, and THAT has to happen BEFORE we can complete the echo command. But evaluating func() produces its own call to echo, which promptly gets executed.

Thus:

<?php

echo "outside func ()" . func ();

?>

effectively becomes:

<?php

//func ()

{

echo "within func ()";

}

echo "outside func ()" . '';

?>

Due to the way TCP/IP packets are buffered, using echo to send large strings to the client may cause a severe performance hit. Sometimes it can add as much as an entire second to the processing time of the script. This even happens when output buffering is used.

If you need to echo a large string, break it into smaller chunks first and then echo each chunk. The following function will do the trick in PHP5:

<?php

function echobig($string, $bufferSize = 8192)

{

$splitString = str_split($string, $bufferSize);

foreach($splitString as $chunk)

echo $chunk;

}

?>

[Ed. Note: During normal execution, the buffer (where echo's arguments go) is not flushed (sent) after each write to the buffer. To do that you'd need to use the flush() function, and even that may not cause the data to be sent, depending on your web server.]


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

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

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