PHP 使用curl获取文件内容的函数。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 使用curl获取文件内容的函数。相关的知识,希望对你有一定的参考价值。

function file_content($_path) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
  curl_setopt($ch, CURLOPT_URL, $_path);
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}

以上是关于PHP 使用curl获取文件内容的函数。的主要内容,如果未能解决你的问题,请参考以下文章