显示文本框

file_get_contents()

« file_exists | fileatime »
<?php
// loads some data in a temp file
$filename tempnam(sys_get_temp_dir(), "pbe");
file_put_contents($filename"Hello world !");

// reads the file or a url
$string file_get_contents (
    
// string $filename
    
?// [bool $use_include_path = false]
    
// [resource $context]
    
// [int $offset = -1]
    
  // [int $maxlen]
);

// removes the temp file
unlink($filename);
?>
结果
$string = 'world'
示例
#1 file_get_contents  ("tempname",
 
null,
 
null,
 
6,
 
5)
#2 file_get_contents  ("http://www.example.com/",
 
false,
 
null,
 
0,
 
100)
#3 file_get_contents  ("tempname")
#4 file_get_contents  ("tempname",
 
true,
 
"xyz",
 
6,
 
5)
#5 file_get_contents  ()
#6 file_get_contents  ("tempname",
 
null,
 
null,
 ,
 
5)
#7 file_get_contents  ("tempname",
 
null,
 ,
 
6,
 
5)
#8 file_get_contents  ("http://www.example.com/",
 
false,
 
null,
 
0,
 
99999)
#9 file_get_contents  ("abc")
#10 file_get_contents  ("tempname",
 
true,
 
null,
 
6,
 
5)
另请参阅
fgets, fread, sys_get_temp_dir, tempnam