GXC Posted February 15, 2005 Report Share 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) Link to comment Share on other sites More sharing options...
рпр Posted February 15, 2005 Report Share Posted February 15, 2005 is_file() http://lv.php.net/manual/en/function.is-file.php Link to comment Share on other sites More sharing options...
рпр Posted February 15, 2005 Report Share 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); } Link to comment Share on other sites More sharing options...
GXC Posted February 15, 2005 Author Report Share 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 } ?> Link to comment Share on other sites More sharing options...
рпр Posted February 15, 2005 Report Share Posted February 15, 2005 a ir else { // Do nothing } tad tik pat labi var to vispaar nerakstiit. Link to comment Share on other sites More sharing options...
Recommended Posts