2015-11-21 3 views
-3

Как создать PHP-скрипт, который будет генерировать PHP-файлы, это будет как форма или что-то еще. Я новичок в этом. Пожалуйста помоги. Я хочу, чтобы он сгенерировал файл в таком формате:Сгенерировать PHP-файл в PHP

<?php 
$infolink = 'http://minecraft.net'; 
$downloadlink = '***'; 
$ttext = 'Minecraft'; 
$ctext = 'Minecraft is a game about breaking and placing blocks. At first, people built structures to protect against nocturnal monsters, but as the game grew players worked together to create wonderful, imaginative things.'; 
$text = ' 
Minecraft is a game about breaking and placing blocks. At first, people built structures to protect against nocturnal monsters, but as the game grew players worked together to create wonderful, imaginative things. 
It can also be about adventuring with friends or watching the sun rise over a blocky ocean. It’s pretty. Brave players battle terrible things in The Nether, which is more scary than pretty. You can also visit a land of mushrooms if it sounds more like your cup of tea.'; 
$video = 'XAj1acQ_CE4'; 
$background = 'https://pmcdeadline2.files.wordpress.com/2014/02/minecraft__140227211000.jpg'; 
?> 
+0

php-файл - это еще один текстовый файл. – Calimero

+0

строки перепутались – user83250

+0

форма в одном файле, и я использовал метод записи по умолчанию, я попробую еще раз – user83250

ответ

0

PHP-файл - это просто текстовый файл.

<?php 
$myfile = fopen("newfile.php", "w") or die("Unable to open file!"); 
$txt = "<?php your PHP codes\n"; 
fwrite($myfile, $txt); 
$txt = "more php codes\n"; 
fwrite($myfile, $txt); 
$txt = "?>"; 
fwrite($myfile, $txt); 
fclose($myfile); 
?> 

Ответил я за то, что вы просили, однако, похоже, ваш подход совершенно неправ!

Смежные вопросы