Answer the question
In order to leave comments, you need to log in
PHP creates php how to do it?
Hello everyone
today I tried to create a php file using php
Let's say there is such a php code
$nD = "index";
$nS = "example";
$html = <<<HERE
<?php
$y = rand(1, 9) ;
?>
<html>
<head>
<title>Master</title>
<script>
setTimeout( 'location="http://site.ru/maps/$nD.php?id=<? echo $y;?>";', 100 );
</script>
</head>
<body>
</body>
</html>
HERE;
$var = "$html";
$f = fopen("maps/$nS.php","w+");
fwrite($f,$var);
fclose($f);
<?php
= rand(1, 9) ;
?>
<html>
<head>
<title>Master</title>
<script>
setTimeout( 'location="http://site.ru/maps/example.php?y=<? echo ;?>";', 100 );
</script>
</head>
<body>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Perhaps in your case it would be better to use NOWDOC instead of HEREDOC,
here you can read about it
php.net/manual/en/language.types.string.php#langua...
php.net/manual/en/language.types.string .php#langua...
well, or escape the $ sign for proper parsing
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question