Article View: pl.comp.lang.php
Article #214Re: PHP 4.06
From: Artur Pozniak
Date: Sun, 19 Aug 2001 10:55
Date: Sun, 19 Aug 2001 10:55
53 lines
2469 bytes
2469 bytes
uzyj funkcji fgets, ew. fgetss dla plików HTML [usuwa tagi HTML'owskie].
string fgets (int fp, int length)
Returns a string of up to length - 1 bytes read from the file pointed to by
fp. Reading ends when length - 1 bytes have been read, on a newline (which
is included in the return value), or on EOF (whichever comes first).
If an error occurs, returns FALSE.
Common Pitfalls:
People used to the 'C' semantics of fgets should note the difference in how
EOF is returned.
The file pointer must be valid, and must point to a file successfully opened
by fopen(), popen(), or fsockopen().
A simple example follows: Example 1. Reading a file line by line
==========================================
$fd = fopen ("/tmp/inputfile.txt", "r");
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose ($fd);
==========================================
pozdr.
level
Użytkownik _Xario_ <xario@go2.pl> w wiadomości do grup dyskusyjnych
napisał:9lo4vs$68$1@news.tpi.pl...
> Witam...
> Mam nastepujacy blad - po przetworzeniu tego kodu :
>
> <?PHP
> {
> $zobacz = fopen("news.txt","r+");
> echo($zobacz);
> fclose($zobacz);
> }
> ?>
>
> Zamiast zawartosci news.txt na stronie wyswietla sie napis "Resource id
#1"
> Nie mam pojecia co to znaczy... dopiero zaczynam zabawe z php wiec prosze
> bardziej doswaidczonych o rade :)
>
> pozdrawiam
> _Xario_
>
>
Technical Details
Message-ID:
<9lo5nv$2ts$1@news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!pcmedia.com.pl!news.man.szczecin.pl!news.task.gda.pl!news.tpi.pl!not-for-mailReferences:
<9lo4vs$68$1@news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!pcmedia.com.pl!news.man.szczecin.pl!news.task.gda.pl!news.tpi.pl!not-for-mail From: "Artur Pozniak" <level@link.pl> Newsgroups: pl.comp.lang.php Subject: Re: PHP 4.06 Date: Sun, 19 Aug 2001 12:55:57 +0200 Organization: tp.internet - http://www.tpi.pl Lines: 55 Message-ID: <9lo5nv$2ts$1@news.tpi.pl> References: <9lo4vs$68$1@news.tpi.pl> NNTP-Posting-Host: pa17.leszno.sdi.tpnet.pl X-Trace: news.tpi.pl 998218303 3004 213.25.221.17 (19 Aug 2001 10:51:43 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: 19 Aug 2001 10:51:43 GMT X-Notice-1: This post has been postprocessed on the news.tpi.pl server. X-Notice-2: Subject line has been filtered and leading Odp: string removed. X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Newsreader: Microsoft Outlook Express 5.00.2417.2000 X-Subject: Odp: PHP 4.06 X-MSMail-Priority: Normal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit