質問

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