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.

有帮助吗?

解决方案

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>" ;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top