给定一个指向文件的URL,我如何打开它并用PHP读取内容?
$file = fopen("http://www.alinktomyfile.com/kasfafa", "r");
这行有一个错误。文档说使用stream_get_contents()作为URL,但我得到了一个错误:
$file_contents = stream_get_contents($file);
fclose($file);
错误:
警告:stream_get_contents()要求参数1为resource,在第24行的/Users/donald/Desktop/php_boilerplate.php中给定null
尝试file_get_contents()
$file = file_get_contents("http://www.alinktomyfile.com/kasfafa");