file handling
|open file
opens a file and returns the content as a string
full source of open file [ line 1 - 16 ] | download open file
| 1 | <? |
| 2 | function file_open($filename) |
| 3 | { |
| 4 | if($fp = @fopen($filename, "r")) |
| 5 | { |
| 6 | $fp = @fopen($filename, "r"); |
| 7 | $contents = fread($fp, filesize($filename)); |
| 8 | fclose($fp); |
| 9 | return $contents; |
| 10 | }else{ |
| 11 | return false; |
| 12 | } |
| 13 | } |
| 14 | // use like |
| 15 | $text = file_open('data/file.txt'); |
| 16 | ?> |
35 hits by 13 users in the last 30 minutes.