Can anyone tell me how to Dynamically generate a new php file? Like generate it and then set it's code. Say that there was a user who created an account. When he created that account I would like it to generate his profile page. Thanks!
Asked
Active
Viewed 60 times
-3
-
2Store the user data in a database of some sort, then you can use a single profile.php file to show all users. – JimL Sep 21 '14 at 01:46
-
This is not the way it would typically done. Typically you would store the user's data in a DB, and then populate a HTML template with that data. – Kohjah Breese Sep 21 '14 at 01:46
-
There is a good answer to this question, and it's about 600 pages long: http://lpmj.net/3rdedition/. Or if you're actually looking for code that writes other code, you might look into [LISP](http://stackoverflow.com/questions/2664618/what-does-it-mean-that-lisp-can-be-written-in-itself). – Chase Ries Sep 21 '14 at 01:47
1 Answers
1
You can do this using file_put_contents, but it's bad practice. It's much easier/better to just have one PHP file, profile.php for example, which takes a GET parameter for the user ID, then dynamically displays the correct information based on the user ID.

NeuroXc
- 652
- 6
- 22