Meng convert nama file yang aneh menjadi friendly

This item was filled under [ Code Snippet, PHP ]

Fungsinya adalah:

// CLEAN FILENAME
function jin_gfile($txt) {
	$txt = preg_replace("/[^a-zA-Z0-9s.]/", "_", $txt);
	return $txt;
}

Penggunaan:

echo jin_gfile("Nama File ini.\$uper/aneh.pdf");

hasilnya akan menjadi nama_file_ini___uper_aneh.pdf
berguna juga untuk meng-convert alamat url menjadi tetap cantik.

Rate this topic:
1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 5.00 out of 5)
Loading ... Loading ...
Popularity: 1,903 views
Tagged with: [ , ]
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Artikel Sejenis

Leave a Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Halaman ini di eksekusi dalam waktu 1.549 detik! (koneksi mayan bagus nih...)