string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
这个参数怎么是一个套一个,看不懂?
也没弄成功,怎么指定START和LENGTH

解决方案 »

  1.   

    $url="/test.wmv";
    $start=0;
    $length=300;
    file_get_contents($url, false, NULL, $start, $length);
    带[]的意思是参数可选...
    可以写为
    file_get_contents($url);
    file_get_contents($url, false);
    file_get_contents($url, false, NULL);
    file_get_contents($url, false, NULL, $start);
    file_get_contents($url, false, NULL, $start, $length);
      

  2.   

    false, NULL, 
    分别对应的是什么?
      

  3.   

    问问题之前,先去手册看看.... 看手册里有什么不明白的.再发问...PHP的手册做的蛮好的....
      

  4.   

    早看过了
    手册上没有对参数解释
    bool use_include_path [, resource context 
    这到底是什么东东
      

  5.   

    resource context 是一个流句柄...
    可以用 
    Here is an example.<?php// Define a context for HTTP.
    $aContext = array(
        'http' => array(
            'proxy' => 'tcp://127.0.0.1:8080', // This needs to be the server and the port of the NTLM Authentication Proxy Server.
            'request_fulluri' => True,
            ),
        );
    $cxContext = stream_context_create($aContext);// Now all file stream functions can use this context.$sFile = file_get_contents("http://www.php.net", False, $cxContext);echo $sFile;
    ?>
    以指定代理等......这几个参数与 指定行数无关.... 手册上也说明,一般用 NULL 即可....
      

  6.   

    http://cn.php.net/manual/zh/function.stream-context-create.php
      

  7.   

    尽量别用file_get_contents 速度和效率不是很好
      

  8.   

    看你的信誉值就不爽....
    curl.
      

  9.   

    回复人:tianyaxiao() ( ) 信誉:94 2007-7-16 0:53:23 得分:0
    ?
    那我要抓取别人网站上的内容还能用什么呢?fsockopen 不错,可以使用 http/1.1 能够压缩传输内容,使用的带宽为未压缩的1/3--1/2左右,
      

  10.   

    根据我的使用经验,fsockopen来抓取对方内容的时候才可能有效率问题,这是绝对经过测试的,如果对方服务器有进行一些特殊的设置,这个函数效率会非常低。
      

  11.   

    ......无语.....啥远程函数,都离不开 fsockopen
      

  12.   

    嘿嘿,能够不用 socket 就读取远程数据?