开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜