代码之家  ›  专栏  ›  技术社区  ›  Majid Fouladpour

PHP-发送带有文件\u get\u内容的cookie

php
  •  40
  • Majid Fouladpour  · 技术社区  · 14 年前

    // Create a stream
    $opts = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Accept-language: en\r\n" .
                  "Cookie: foo=bar\r\n"
      )
    );
    
    $context = stream_context_create($opts);
    
    // Open the file using the HTTP headers set above
    $file = file_get_contents('http://www.example.com/', false, $context);
    

    如何发送多个cookie?比如1或2,或者什么?

    #1

    "Cookie: user=3345&pass=abcd\r\n"
    

    #2

    "Cookie: user=3345\r\n" . 
    "Cookie: pass=abcd\r\n"
    
    2 回复  |  直到 4 年前