Jump to content

Cum Creez Un Fisier Cu Php ?


gaby

Recommended Posts

Mai jos gasiti o metoda prin care puteti crea un fisier cu ajutorul PHP-ului, mai exact prin intermediul functiei fopen():

$numeFisier = 'primulMeuFisier.txt';
$fh = fopen($numeFisier, 'w') or die('Nu pot deschide fisierul.');
fclose($fh);[/code] [b][color="#FF8C00"]Explicatie:[/color][/b]
[code]$fileName = 'myFirstFile.txt';
-reprezinta numele fisierului care urmeaza sa fie creat.
$fh = fopen($fileName, 'w') or die("can't open file");
-functia fopen() va incerca sa deschida fisierul, insa daca acesta nu exista va fi creat deoarece la parametrul 2 am pus w ceea ce inseamna (write) ca o sa-l creeze.
fclose($fh);

-reprezinta inchiderea fisierului deschis mai sus.

Numai bine :pct2: !

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.