Xanco Posted April 5, 2013 Share Posted April 5, 2013 Hello peoples. Right, this is what I'm trying to do; I'm trying to make a php script that generates a html file. I've almost got it. I just need to finish giving the html file a name. The name will be a random number, but I need it to have .html at the end (obviously). Anybody know how I can do that? Here's what I tried (might give you some idea of what I'm doing): $file = rand()AND".html"; $file = rand()+".html"; $file = rand()".html"; - Thanks, Xanco Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/ Share on other sites More sharing options...
exeTrix Posted April 5, 2013 Share Posted April 5, 2013 I don't like rand because it can produce the same result. If I'm creating a "random" file name I'll usually use something like this: $fileName = md5( time() . ' some crazy string just to keep the hackers on their toes ' ); echo $fileName . '.html'; Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423116 Share on other sites More sharing options...
requinix Posted April 5, 2013 Share Posted April 5, 2013 uniqid mt_rand Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423131 Share on other sites More sharing options...
Xanco Posted April 5, 2013 Author Share Posted April 5, 2013 Thanks everyone Link to comment https://forums.phpfreaks.com/topic/276580-random-string-with-html-at-the-end/#findComment-1423136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.