我跟随名为$arr
的数组:
Array(
[0] => Array
(
[url] => href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png"
)
[1] => Array
(
[url] => href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" )
)
我不想在数组中想要的内容中使用字符串href:
Array(
[0] => Array
(
[url] => http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
)
[1] => Array
(
[url] => http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf )
)
我该怎么做?
答案 0 :(得分:2)
试试这个:
foreach ($array as $str) {
$str = str_replace('href=','',$str);
}
编辑:
您可以在str_replace()
函数中使用数组。像这样:
foreach ($array as $str) {
$str = str_replace(array('href=','"'),'',$str);
}