wordwrap + nl2br = Satır sonlarını ihtiyacınız daha fazla?

1 Cevap php

I have a textarea inside a form. No wrap in the html code is provided. In the php file (forms action=phpfile.php) I get the value of the textarea like so:

$ad_text=wordwrap(nl2br($_POST['annonsera_text']), 47, '<br>', true);
echo $ad_text;

Sonra çıktı:

hellohellohellohellohellohellohellohellohellohe
llohello.
hi.
hi.
hi.

/> hi.
hi.
hi.
hi.

/>

ve form textarea orijinal giriş şöyle:

hellohellohellohellohellohellohellohellohellohe
llohello.
hi.
hi.
hi.
hi.
hi.
hi.
hi.

A '/>' izledi üçüncü \ n kadar sonra bir satır sonu, orada görünmek

Herhangi bir ide neden?

Teşekkürler

1 Cevap

wordwrap doesn't view <br> bir satır açmaya olarak - eğer taşımak nl2br Ne istiyorsunuz, ama wordwrap parametresini "\ n" ile değiştirmek gerektiği gibi çalışacak wordwrap sonra çift-aralık kaçının:

$ad_text = nl2br(wordwrap($_POST['annonsera_text'], 47, "\n", true));