GXC Posted February 15, 2005 Report Posted February 15, 2005 sveiki, doma ir uzraxtit skriptu kas parbauditu vai tads fails eksiste un ja nee tad izveidot jaunu. Nu es uzraxtiju shadu: if(is_readable($dbfile)) { // Do nothing } else { $fnew = fopen("$dbfile", "w+"); flock($fnew, 1); } Vinsh man izgatavo jaunu jebkura gadijuma(ja tads fails jau ir vai nav)
рпр Posted February 15, 2005 Report Posted February 15, 2005 is_file() http://lv.php.net/manual/en/function.is-file.php
рпр Posted February 15, 2005 Report Posted February 15, 2005 un mazāk būs jāraksta, ja rakstīsi šādi: if(!is_file($dbfile)) { $fnew = fopen("$dbfile", "w+"); flock($fnew, 1); // shitas uz win neies, pasham jaataisa alternatiiva // taaalaak neaimzirsti arii fclose($fnew); }
GXC Posted February 15, 2005 Author Report Posted February 15, 2005 beigas sataisiju ar shitadu: <? // Create New DB if the DB not found if (!file_exists("$dbfile")) { $fnew = fopen("$dbfile", "w+"); flock($fnew, 1); } else { // Do nothing } ?>
рпр Posted February 15, 2005 Report Posted February 15, 2005 a ir else { // Do nothing } tad tik pat labi var to vispaar nerakstiit.
Recommended Posts