Autor Zpráva
hans
Profil *
prosím o pomoc jak zamezit výpisu "Warning" při otevírání streamu $stream = fopen($url,'r');
pokud zadám neplatnou URL adresu jako parametr
funkce by měla vrátit FALSE ??

veškeré testování jako if(!$stream) jde samozřejmě ošetřit ale provede se až poté co se to PHP pokusí otevřít
Peca
Profil
Nejlehčí je dát @ před fopen. ... = @fopen(...
*Čvachta*
Profil *
fopen($url,'x'); nebo x+
hans
Profil *
Peca:

no jo no, jak prosté :-) to mně blbce nenapadlo a já se tady s tím mořím,
díky moc

Čvachta:
ten parametr x je co zač ?? manual na php.net o ničem takovém nepíše
Peca
Profil
Co to máš za manuál? :-)
http://cz2.php.net/fopen
hans
Profil *
já tam vidím 'r' 'w' nebo 'a' případně 'b' ale žádné 'x' ??
manuál je stejný - na tom odkazu tam nic nevidím :-)
Tomik
Profil
hans
Vážně? :)

Já ho tam tedy vidím.. :)
*Čvachta*
Profil *
x
Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.
x+
[i]Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files./i]
Hugo
Profil
Pokud se nepletu, tak x nefunguje pro soubory na jiném serveru.
Tomik
Profil
Hugo
and only works for local files.
Ano, máš pravdu...
Toto téma je uzamčeno. Odpověď nelze zaslat.

0