Frage

this is my code

foreach(glob("useri/*.txt") as $filename) {
 echo "<li><a href=$filename>$filename</a></li>" ;
}

the output is :

useri/caca.txt
useri/pipi.txt
useri/pufu.txt
useri/sadzxc.txt
useri/zan.txt

I want to remove useri/

TY on every submit button a .txt is created.

War es hilfreich?

Lösung

Simply remove first 6 characters of your string with substr.

Try this :

foreach (glob("useri/*.txt") as $filename) {
$file = substr($filename, 6);
 echo "<li><a href=$filename>$file</a></li>" ;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top