Remove All Character before a String and the String itself

Umair Ayub

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?

TiMESPLiNTER

Use PHPs built-in function pathinfo():

$fileName = pathinfo($product->image, PATHINFO_BASENAME);

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Regex - find all kinds of numbers in a String before a specific Character

분류에서Dev

JQuery Remove Text Before String

분류에서Dev

Replace All `[ ]` character from the string

분류에서Dev

Cut a string before a character in better way in php

분류에서Dev

Remove all characters from the string

분류에서Dev

How can I extract text before a character or string in a batch file?

분류에서Dev

remove all empty values from url string

분류에서Dev

remove special character from string in snowpipe copy command in snowflake

분류에서Dev

How do I remove a character once from a string [python]?

분류에서Dev

Bash - Remove the last character of the line this before?

분류에서Dev

Remove all duplicate word from string using shell script

분류에서Dev

Remove all the . (dots) from a string except the last one

분류에서Dev

string to character conversion error?

분류에서Dev

Java: Next character in String

분류에서Dev

Character to string . confused

분류에서Dev

Java: Next character in String

분류에서Dev

Split string at an uppercase character

분류에서Dev

Conversion of character to String not working

분류에서Dev

Search a string without . character

분류에서Dev

Asterisk before the string in a regex

분류에서Dev

Asterisk before the string in a regex

분류에서Dev

C# Full-text search string format : string remove all adjacent duplicates and append with 'AND' 'OR'

분류에서Dev

Remove a certain character from a list, after adding one element of it to a string already

분류에서Dev

Remove special character and apostrophe and unwanted space in string using re.sub function in python

분류에서Dev

how to search a string for a character and no where it is in the string then change it

분류에서Dev

how to search a string for a character and no where it is in the string then change it

분류에서Dev

How to remove , in the string in javascript

분류에서Dev

grep for string without another string before it

분류에서Dev

Longest Repeating Character In String - Javascript

Related 관련 기사

  1. 1

    Regex - find all kinds of numbers in a String before a specific Character

  2. 2

    JQuery Remove Text Before String

  3. 3

    Replace All `[ ]` character from the string

  4. 4

    Cut a string before a character in better way in php

  5. 5

    Remove all characters from the string

  6. 6

    How can I extract text before a character or string in a batch file?

  7. 7

    remove all empty values from url string

  8. 8

    remove special character from string in snowpipe copy command in snowflake

  9. 9

    How do I remove a character once from a string [python]?

  10. 10

    Bash - Remove the last character of the line this before?

  11. 11

    Remove all duplicate word from string using shell script

  12. 12

    Remove all the . (dots) from a string except the last one

  13. 13

    string to character conversion error?

  14. 14

    Java: Next character in String

  15. 15

    Character to string . confused

  16. 16

    Java: Next character in String

  17. 17

    Split string at an uppercase character

  18. 18

    Conversion of character to String not working

  19. 19

    Search a string without . character

  20. 20

    Asterisk before the string in a regex

  21. 21

    Asterisk before the string in a regex

  22. 22

    C# Full-text search string format : string remove all adjacent duplicates and append with 'AND' 'OR'

  23. 23

    Remove a certain character from a list, after adding one element of it to a string already

  24. 24

    Remove special character and apostrophe and unwanted space in string using re.sub function in python

  25. 25

    how to search a string for a character and no where it is in the string then change it

  26. 26

    how to search a string for a character and no where it is in the string then change it

  27. 27

    How to remove , in the string in javascript

  28. 28

    grep for string without another string before it

  29. 29

    Longest Repeating Character In String - Javascript

뜨겁다태그

보관