Search notes:

PHP functions fopen(), fread() and fclose()

<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>fopen fread fclose</title>
</head>
<body>

<code><pre>
<?php

  $f = fopen(__FILE__, 'r');

  while(!feof($f)) {

    $txt = fread($f, 1024);
    print htmlspecialchars($txt);

  }
  fclose($f);

?>
</pre></code>

</body>
</html>
Github repository about-php, path: /filesystem/fopen_fread_fclose.html

See also

PHP functions related to the filsystem

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740174419, '3.137.180.245', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/php/snippets/filesystem/fopen-fread-fclose(63): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78