Cibiņš Posted June 7, 2010 Report Share Posted June 7, 2010 (edited) Kā pie operācijas var padot lai izveido failu ar specifisku saturu? Piemēram pie formas posta lai no lauka "name" paņem ierakstīto vērtību un attiecīgi tā arī failu izveido un nosauc - name.php un ievieto automātiski lapā skriptu kaukādu vai teikumu? Cik nu sanāk lai izveido failu tā jau vispār sanāk, bet vienīgi ka kā lai dabon automātiski iekšā saturu kaukādu - piem tekstu "kaamis"? $fails = "fails.php"; $failsHandle = fopen($fails, 'w') or die("ej kakaat"); fclose($failsHandle); Edited June 7, 2010 by Cibiņš Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted June 7, 2010 Author Report Share Posted June 7, 2010 (edited) A nee viss oki :) Edited June 7, 2010 by Cibiņš Quote Link to comment Share on other sites More sharing options...
marcis Posted June 7, 2010 Report Share Posted June 7, 2010 file_put_contents() FTW Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted June 7, 2010 Author Report Share Posted June 7, 2010 (edited) Bet kā panākt lai šis skrpts failā ievieto $content = "<?php....tipa no kveerija skriptu lai ieliek nevis veic kaukaadas mistiskas operaacijasa bet lai nedara neko un vienkarshi ieliek to skriptu tur?? Visu laiku balta lapa :( $filename = $path_page.$pgname.".php"; $failsHandle = fopen($filename, 'w, r') or die("ej kakaat"); fclose($failsHandle); $content = " <?php $result = mysql_query('SELECT * FROM pg_pages WHERE pg=".$pg."); while($row = mysql_fetch_array($result)){echo $row['data_$lang'];} ?> "; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo "Nevar atveert failu ($filename)"; exit; } if (fwrite($handle, $content) === false) { echo "Nevar ierakstiit informaaciju failaa ($filename)"; exit; } fclose($handle); } else { echo "Fails $filename nav rakstaams"; } Edited June 7, 2010 by Cibiņš Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted June 8, 2010 Author Report Share Posted June 8, 2010 Neviens nezin? Quote Link to comment Share on other sites More sharing options...
Леший Posted June 8, 2010 Report Share Posted June 8, 2010 (edited) $content = " <?php \$result = mysql_query('SELECT * FROM pg_pages WHERE pg=".$pg."); while(\$row = mysql_fetch_array(\$result)){echo \$row['data_\$lang'];} ?> "; Edited June 8, 2010 by Леший Quote Link to comment Share on other sites More sharing options...
Леший Posted June 8, 2010 Report Share Posted June 8, 2010 Un ir divi punkti, kas man nav skaidri: WHERE pg=".$pg." Kur tiek definēts $pg? echo \$row['data_\$lang'] ??? Quote Link to comment Share on other sites More sharing options...
Cibiņš Posted June 8, 2010 Author Report Share Posted June 8, 2010 (edited) Mainiigais defneets commonaa. taga straadaaaaaaaaaa :)) Paldies :)) Edited June 8, 2010 by Cibiņš Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.