[英]How can I get just the URL from this?
我为我的网站收到了很多DMCA删除电子邮件,我正在尝试自动删除我网站上的这些曲目。
所有的电子邮件看起来都与此类似。
http://example.com/title-to-post.html title - to post
http://example.com/title-of-post.html title - of post
http://example.com/some-song-artist-some-song-name.html some song artist - some song name
但是它们中有很多,我只想返回其中每个部分的URL部分,例如下面的例子。
http://example.com/title-to-post.html
http://example.com/title-of-post.html
http://example.com/some-song-artist-some-song-name.html
编辑:我将这些文件存储到txt文件,然后使用标准代码调用它们。
$urls = file_get_contents( "oururls.txt" );
$data = explode(",", $urls);
foreach ($data as $item) {
echo "$item";
echo '<br>';
}
没有什么真正的花哨,它如何回归标题,我只想要网址 。
如果URL后面总是有空格,你可以用“”分解文本并得到第一部分。 例:
$example = explode(" ", $url);
echo $example[0];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.