Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   Нужен php скриптик! (https://forum.antichat.xyz/showthread.php?t=80170)

fly 08.08.2008 17:35

Нужен php скриптик!
 
Нужно написать элементарный скрипт, алгоритм работы такой, есть столбец

Код:

<font style="position: absolute;overflow: hidden;height: 0;width: 0">
test1 <a href="http://xost.com/">test1</a> test1
test2<a href="http://xost.com/">test2</a> test2
test3<a href="http://xost.com/">test3</a> test3
.
.
.
</font>

Надо просто чтобы я добавил в форму сее и это преобразовалось в сплошную строчку!

Т.е. вот так чтобы получилось
Код:

<font style="position: absolute;overflow: hidden;height: 0;width: 0"> test1 <a href="http://xost.com/">test1</a> test1 test2<a href="http://xost.com/">test2</a> test2 test3<a href="http://xost.com/l">test3</a> test3...</font>
Пишите в личку решение, я 5$ могу дать!

fly 08.08.2008 18:12

Один человек помог

Ошибка выходит


Код:

<font style="position: absolute;overflow: hidden;height: 0;width: 0"> test1 <a href="http://xost.com/">test1</a> test1 test2<a href="http://xost.com/">test2</a> test2 test3<a href="http://xost.com/l">test3</a> </font>



а получается так

Код:

<font style=\"position: absolute;overflow: hidden;height: 0;width: 0\">test1 <a href=\"http://xost.com/\">test1</a> test1test2<a href=\"http://xost.com/\">test2</a> test2test3<a href=\"http://xost.com/\">test3</a> test3</font>



слеши почему вставляет "\"? кАК ЧТОБЫ БЕЗ НИХ?



Сам скрипт
Код:

<?
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");

  if (isset($_POST['a']))
  die(str_replace(array("\r","\n"), "", $_POST['a']));

  echo "<form method=post>\r\n";
  echo "<textarea name=a rows=10 cols=40></textarea>\r\n";
  echo "<input type=submit>\r\n";
  echo "</form>\r\n";
?>


Gifts 08.08.2008 18:13

PHP код:

$str=<<<HTT
<font style="position: absolute;overflow: hidden;height: 0;width: 0">
test1 <a href="http://xost.com/">test1</a> test1
test2<a href="http://xost.com/">test2</a> test2
test3<a href="http://xost.com/">test3</a> test3
.
.
.
</font>
HTT;
$str=preg_replace("#\r\n#",'',$str); 


Isis 08.08.2008 18:59

PHP код:

str_replace(array("\r","\n"), NULL$str


Piflit 08.08.2008 19:04

PHP код:

die(str_replace(array("\r","\n"), ""stripslashes($_POST['a']))); 


fly 08.08.2008 22:42

вСЕМ СПАСИБО)! ЗаКРЫТ вопрос!


Время: 14:27