a.php 和 b.php都是在同一服务器下的,a.php是通过图片路径取到图片的,那么告诉b.php这个图片路径就好了。

解决方案 »

  1.   

    a.php和b.php不同服务器不同域名
      

  2.   

    给个完整的路径不就行, 带域名的
    当然也可以curl   post过去
      

  3.   

    curl   post 图片的url过去就行了?
    不是需要post整张图片过去么?
      

  4.   

    总之你告诉b.php你图片的地址,或post整张图片过去,看你想怎么用了
      

  5.   

    2.php :$data = array(
        'f' => '@E:/xampp/htdocs/temp/1.jpg',
        'a' => '1aaa'
    );$ch = curl_init('http://localhost/temp/3.php');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_POST, true);
    $a = curl_exec($ch);
    echo '<br>this is 2.php : <br>';
    var_dump($a);
    echo '<br>';
    var_dump(curl_error($ch));
    curl_close($ch);
    3.php:echo 'this is 3.php : <br>';
    var_dump($_REQUEST);
    var_dump($_FILES);
    echo '<br>';
    执行后显示:
    this is 3.php : 
    array(0) { } array(0) { } this is 2.php : 
    bool(true) 
    string(0) ""哪里出错了呢?
      

  6.   


    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_POST, true);
    倒一下
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);否则会有 413 
    Request Entity Too Large
    The requested resource
    ....
    does not allow request data with POST requests, or the amount of data provided in
    the request exceeds the capacity limit.
      

  7.   


    <?php
    $ch = curl_init();$data = array('name' => 'Foo', 'file' => '@/home/user/test.png');curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_exec($ch);
    ?> 
    看手册curl那块,有这方面的例子
      

  8.   

    学习一下post图片...
    题外话,如果a并不需要保存图片实体的话,这种解决方案占用多一倍的磁盘写入时间和多一倍的带宽,还是直接传图给b好