8
votes

Trouvez le nom de fichier à partir d'une chaîne avec PHP

public/images/portfolio/i-vis/1.jpg
How could i remove all the path regardless of what the filename is using php?

0 commentaires

3 Réponses :


29
votes

regarder basseName () xxx

aussi, dirname () récupère l'autre partie xxx

Si vous avez besoin de plus d'informations - il y a pathinfo ( ) xxx

produit xxx

donc $ info ['nom_fichier' ] vous donne le fichier sans l'extension.


1 commentaires

C'est cool, pouvons-nous aller plus loin et trouver juste le nom de fichier sans l'extension ...



2
votes
echo basename($string);
Take a look at the basename function.

0 commentaires

1
votes

solution alternative. Juste un tas d'explosions xxx


0 commentaires