chizijs Posted April 29, 2010 Report Share Posted April 29, 2010 (edited) Kods $teksts = htmlspecialchars($at_t['teksts']); $get = array( "/\[code](.*?)\[\/code\]/isU" ); $replace = array( "<div class='codetop'>KODS</div><div class='codemain'>$1</div>" ); $teksts = preg_replace($get,$replace,$teksts); echo nl2br($teksts); Bet kad izvāda tekstu [.code] <? echo ""; function ddd (){ if(){} }[./code] iznāk <? echo ""; /> function ddd (){ /> if(){} } Kaut kāds mistisks simbols parādas />, ja pat viņš nekur nav pieminēts?? Edited April 29, 2010 by chizijs Link to comment Share on other sites More sharing options...
php newbie Posted April 29, 2010 Report Share Posted April 29, 2010 (edited) pamēģināju tavu piemēru un nostrādāja diezgan forši. nav nekādu /> varbūt kkas ar encoding. fails nav utf. jo man izskatās ok :) <?php $at_t['teksts'] = ' [.code] <? echo ""; function ddd (){ if(){} }[/.code] '; $teksts = htmlspecialchars($at_t['teksts']); $get = array( "/\[code](.*?)\[\/code\]/isU" ); $replace = array( "<div class='codetop'>KODS</div><div class='codemain'>$1</div>" ); $teksts = preg_replace($get,$replace,$teksts); echo nl2br($teksts); ?> Edited April 29, 2010 by php newbie Link to comment Share on other sites More sharing options...
marcis Posted April 29, 2010 Report Share Posted April 29, 2010 Parādi uzģenerēto sourci, nevis to, ko tev brouzeris vizuāli atrāda. Link to comment Share on other sites More sharing options...
chizijs Posted April 29, 2010 Author Report Share Posted April 29, 2010 (edited) Atrādu kļūdu!! Edited April 29, 2010 by chizijs Link to comment Share on other sites More sharing options...
Recommended Posts