我有一个数组$链接包含在它里面的一些环节,我想删除所有这些都是从网站出现在$ Blocklinks删除元素
$links=array(
'http://ckfht.ca/sultan/files/2016/',
'http://dl1.uploadplus.net/dl2/2016/Sultan.2016/',
'http://www.google.com',
'http://subindomovie.xyz/film/indexof-sultan-720p'
'http://subindomovie.xyz/film/sultan-720-p'
'http://www.liveaccountbook.com/sultan/'
);
$Blocklinks=array(
'subindomovie.xyz',
'www.liveaccountbook.com'
);
/* remove urls containing link from $Blocklinks .. What should i do here??*/
$links=deletelinks($links,$Blocklinks);
/* output */
print_r($links);
output I want
------
Array
(
[0] => http://ckfht.ca/sultan/files/2016/
[1] => http://dl1.uploadplus.net/dl2/2016/Sultan.2016/
[2] => http://www.google.com
)
你有什么试过的?你收到了什么错误信息?如果没有显示错误信息,那么请发布您的PHP错误日志。谢谢 –
您可以使用[strpos函数](http://php.net/manual/en/function.strpos.php)检查字符串是否包含特定子字符串。也使用foreach循环 –
[PHP的:如何从数组中删除特定元素?]可能的副本(http://stackoverflow.com/questions/2448964/php-how-to-remove-specific-element-from-an-数组) – cteski