Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Co robi ta funkcja?
rja
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 8.12.2006

Ostrzeżenie: (0%)
-----


Co dokładnie robi ta funkcja??
  1. <?php
  2. function cleanHtmlToJavascript($textHtml) {
  3. $cleanTextHtml = preg_replace("/[nrt]/", " ", $textHtml);
  4. $cleanTextHtml = str_replace(array('"',"'"),array("&quot;","'"),$cleanTextHtml);
  5. return $cleanTextHtml;
  6. }
  7. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
ikioloak
post
Post #2





Grupa: Zarejestrowani
Postów: 416
Pomógł: 0
Dołączył: 8.01.2004

Ostrzeżenie: (0%)
-----


wykonuje operacje na kodzie html umozliwiajac tym samym przypisanie go do zmiennej typu string. Wykorzystujesz wiec w ten sposob:
  1. <script type="text/javascript">
  2. var zmienna = '<? print cleanHtmlToJavascript($someHtml); ?>';
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 05:50