开发者

What PHP Functions Create Output?

开发者 https://www.devze.com 2023-02-04 21:38 出处:网络
Has anyone ever compiled a list of开发者_开发百科 all the PHP functions/methods that send output to the browser (or STDOUT when running in CLI mode)?A quick search didn\'t show any manual pages with t

Has anyone ever compiled a list of开发者_开发百科 all the PHP functions/methods that send output to the browser (or STDOUT when running in CLI mode)? A quick search didn't show any manual pages with this information (but I could be wrong there)

I'm interested in functions that are designed to do this, not functions that may raise warnings that would be sent directly to the browser.

The print and echo functions are the obvious ones, I'm looking for a list of lesser known output functions, like readfile.

The main reason I'm asking the question is I'd like a list of functions to check for when tracking down "early output" style errors. (headers can't be set, etc.)


Expanding list:

printf
vprintf
var_export
passthru
gzpassthru
fpassthru
debug_print_backtrace

[+] they are rather obvoius but also worth mentioning:

flush
ob_flush
ob_end_flush

And header related functions also produces output, I remember having to run php-cgi, when CLI binary was not available, and there it was especially annoying

header
setcookie
session_start /* with sessions that uses cookie */


There is curl_exec() with setting CURLOPT_RETURNTRANSFER to false.

And are die() and exit() good enough for your list?

Edit: imagepng(), imagejpeg(), imagegif()?

And actually phpinfo().


Have never seen a list, but can add var_dump and print_r for starters? :)


There's one which is often overlooked / eschewed:

trigger_error()
0

精彩评论

暂无评论...
验证码 换一张
取 消