我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

curl_exec直接输出数据?

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.

近期文章

  • Android中的jSONArray解析异常问题
  • php组合列表函数的值
  • 是否可以在页面上将HTML代码作为PHP变量?
  • isset是否需要用于if语句中的所有变量?
  • 如何在注册页面上禁用提交按钮?
  • 如何从电子商务应用程序中设计收入表?
  • 有没有办法通过Flex的HttpService接收图像文件?
  • PHP - fgetcsv - 引号标记在UTF-8编码的Web应用程序中输入丢失
  • json_decode PHP窃听? 同样的Json适用于其他语言
  • PHP setcookie正在添加百分号
  • Php mcrypt无法正常工作
  • 我如何在bootstrap中使用zend布局
  • 多维数组,包含数组父子的信息
  • mysql中具有相同名称的子类别
  • 两个框,两个最大值 - 但未设置哪个值属于哪个框
  • 从对象内部访问同级对象
  • 按内部值对多数组进行排序
  • 在PHP中开始使用树视图/论坛
  • 什么是dInspect,我该如何使用它?
  • 主键上的bindValue如何?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华