给定以下字符串
http://thedude.com/05/simons-cat-and-frog-100x100.jpg
我想使用 substr
或 trim
(或者您认为更合适的其他函数)来返回此内容。
http://thedude.com/05/simons-cat-and-frog.jpg
换句话说,需要删除-100x100
。我需要的所有图像都会在文件名末尾标记此内容,在扩展名之前。
在SO上似乎有关于Ruby和Python的回答,但没有针对PHP/我的需求。
有什么建议吗?