I have image paths like that
com_jshopping/files/img_products/965cc2355d06eacf09958a79af552885.jpg
I want only 965cc2355d06eacf09958a79af552885.jpg
That is the image file name
I have tried
strstr($product->image,'img_products/')
But it outputs this img_products/965cc2355d06eacf09958a79af552885.jpg
I now I can use str_replace()
here but
Is there any other single function to achieve this?
Use PHPs built-in function pathinfo()
:
$fileName = pathinfo($product->image, PATHINFO_BASENAME);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다