Little_Hacker Posted May 14, 2003 Report Share Posted May 14, 2003 Ka lai uztaisa PHP skriptu, kas nolasa no vienkaarsha texta faila informaaciju kas izskataas ~ shaadi: a | b | c a2 | b2 | c2 a3 | b3 | c3 un izvada shaadaa seciiba: a3 :: b3 :: c3 a2 :: b2 :: c2 a :: b :: c :) Tjipo vajag lai nolasa failu no otras puses ;) Es piem izmantoju shaadu skriptu, bet vinsh nolasa datu failu un izvada informaaciju taadaa pashaa seciibaa kaada taa ir ieksh datu faila. <code><font color="#000000"> <font color="#0000CC"><? $fails </font><font color="#006600">= </font><font color="#0000CC">file </font><font color="#006600">(</font><font color="#CC0000">"datufails.txt"</font><font color="#006600">); while (</font><font color="#0000CC">$val </font><font color="#006600">= </font><font color="#0000CC">each </font><font color="#006600">(</font><font color="#0000CC">$fails</font><font color="#006600">)) { </font><font color="#0000CC">$mas </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/explode]explode[/url]</font><font color="#006600">(</font><font color="#CC0000">"|"</font><font color="#006600">,</font><font color="#0000CC">$val</font><font color="#006600">[</font><font color="#0000CC">1</font><font color="#006600">]); print (</font><font color="#CC0000">"<tr><td><b>$mas</font><font color="#006600">[</font><font color="#CC0000">0</font><font color="#006600">]</font><font color="#CC0000"></b> :: $mas</font><font color="#006600">[</font><font color="#CC0000">1</font><font color="#006600">]</font><font color="#CC0000"> :: $mas</font><font color="#006600">[</font><font color="#CC0000">2</font><font color="#006600">]</font><font color="#CC0000"></td></tr>n"</font><font color="#006600">); } </font><font color="#0000CC">?> </font> </font> </code> Link to comment Share on other sites More sharing options...
Roze Posted May 14, 2003 Report Share Posted May 14, 2003 nu paarveido un buus tev apgriezti.. $fails = array_reverse(file ("datufails.txt")); http://lv.php.net/manual/en/function.array-reverse.php Link to comment Share on other sites More sharing options...
Little_Hacker Posted May 15, 2003 Author Report Share Posted May 15, 2003 Njaaa.. tas vien liecina ka manas zināšanas iekš PHP ir ļoti zemas :) Paldies tev Roze.. izdevās man sataisīt to ko vēlējos. Link to comment Share on other sites More sharing options...
Venom Posted May 15, 2003 Report Share Posted May 15, 2003 Ja stringi teff būs vienmēr sadalīti ar | un nevajadzēdu boldot pirmo fīču, varētu uztaisīt kaut ko tādu: $in=file('text.dat'); $in=array_reverse($in); $in=join('</td></tr><tr><td>',$in); $in=str_replace('|',' :: ',$in); echo '<tr><td>'.$in.'</td></tr>'; Link to comment Share on other sites More sharing options...
Recommended Posts