我有这样的输出:
Array
(
[0] => stdClass Object
(
[post] => john Has site <a href='http://www.mysite.com/events/info/4240'>this is a test</a>
[date_created] => 1341853220
)
[1] => stdClass Object
(
[post] => jane Has site <a href='http://www.mysite.com/events/info/1'>test venue</a>
[date_created] => 1341849999
)
[2] => stdClass Object
(
[post] => james Has site <a href='http://www.mysite.com/events/info/4240'>this is a test</a>
[date_created] => 1341680695
)
我想知道是否有任何方法可以得到这样的结果:
Array
(
[0] => stdClass Object
(
[post] => john Has site this is a test
[number] => 4240
[date_created] => 1341853220
)
[1] => stdClass Object
(
[post] => jane Has site test venue
[number] => 1
[date_created] => 1341849999
)
[2] => stdClass Object
(
[post] => james Has site this is a test
[number] => 4240
[date_created] => 1341680695
)
我想要的是消除 html 标记以及 url,只保留 url 末尾的名称和数字,以便我可以存储它并在以后使用它。我试图在 foreach 中使用 str_replace 但我找不到正确的方法来做到这一点,或者还有其他方法可以做到这一点吗?
谢谢