curl_exec is directly outputing data?
I have this code
开发者_如何学编程<?php
function get(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://stackoverflow.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
$c = curl_exec($ch);
curl_close($ch);
die("A");
return $c;
}
$first = get();
?>
but look what's output! It just prints off everything returned from curl_exec();
how is that possible?
Yes (as you already have tested).
curl_exec
PHP Manual does return output directly to the browser unless you make use of the CURLOPT_RETURNTRANSFER
constant as documented.
精彩评论