簡體   English   中英

PHP preg_match與html標記

[英]PHP preg_match with html tags

我正在嘗試吸引模式中的一些字符串。

字符串是

<br /><br /><br />Text i want here
<br /></div>

我想要:“我要在這里輸入文字”

我的嘗試是

preg_match('!<br /><br /><br />(.*?)<br /></div>!xi', $homepage, $matches);

但是失敗了。

**我使用x是因為
他們有一些空格或\\ n。

<br />
<br />
<br />Text u want here
<br /></div>

使用strip_tags("<br /><br /><br />Text i want here<br /></div>")

strip_tags將從字符串中剝離所有HTML和PHP標記。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM