Xanco Posted April 5, 2013 Share Posted April 5, 2013 Hello peoples. You may of been my question before, regarding the same issue. I, however, cannot seem to make my string end in .html. Here's the code: $file = md5( time().'' ); This does create a random sting, which I am using to generate links, like so: mywebsite.com/ffwjiafqoapwdlc. But I want it to end in .html: mywebsite.com/ffwjiafqoapwdlc.html. Is there anything I can do to get this result? - Thanks, Xanco Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/ Share on other sites More sharing options...
Jessica Posted April 5, 2013 Share Posted April 5, 2013 Uhm. First of all you don't need the .'' in there. Add your ".html" string to the end. Look at the manual for string concatenation and parsing. Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/#findComment-1423169 Share on other sites More sharing options...
Solution Mad programmer Posted April 5, 2013 Solution Share Posted April 5, 2013 Hello, Why not just append to the string? $string .= '.html';? Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/#findComment-1423171 Share on other sites More sharing options...
Xanco Posted April 5, 2013 Author Share Posted April 5, 2013 Let me explain. My website will create a file (which I need to be a HTML file), but it create a file with no extension. My code above is naming that file. - Thanks, Xanco Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/#findComment-1423176 Share on other sites More sharing options...
Xanco Posted April 5, 2013 Author Share Posted April 5, 2013 Ahh, got it. Thanks everybody Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/#findComment-1423178 Share on other sites More sharing options...
requinix Posted April 5, 2013 Share Posted April 5, 2013 exeTrix gave you the answer in the other thread. $fileName = md5( time() . ' some crazy string just to keep the hackers on their toes ' ); echo $fileName . '.html'; By the way, when you don't think you've gotten the answer you need, creating yet another thread is not the solution. Say that you don't understand and give people a chance to clarify. When you make a second thread it seems like you're just trying to ignore the people who were helping you before. Quote Link to comment https://forums.phpfreaks.com/topic/276589-how-to-make-my-random-string-end-in-html-rephrased/#findComment-1423179 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.