ilh*_*han 2 php https fopen facebook
<?php
$handle = fopen("https://graph.facebook.com/search?q=mark&type=user&access_token=2227470867|2.mLWDqcUsekDYZ_FQQXYnHw__.3600.1279803600-100001317997096|YxS1eGhjx2rpNYLNE9wLrfb5hMc.", "r");
echo $handle;
?>
Run Code Online (Sandbox Code Playgroud)
为什么它会回显Resource id #4而不是页面本身?
因为fopen返回一个指向文件的resurce指针,而不是文件的内容.它只是打开它以便随后读取和/或写入,取决于您打开文件的模式.
您需要fread()来自$ handle中引用的资源的数据.
这是你可以在php.net的手册页上自己阅读的所有基本内容
小智 6
一旦你创建了$ handle,你现在需要fread()内容.
$contents = '';
while (!feof($handle))
{
$contents .= fread($handle, 8192);
}
fclose($handle);
echo $contents;
Run Code Online (Sandbox Code Playgroud)
来源:php.net/manual/en/function.fread.php
| 归档时间: |
|
| 查看次数: |
14037 次 |
| 最近记录: |