PHP Generated files php
This is an original HTML file
Untitled Document
This is an HTML file that has been processed.
Untitled Document
Then extract the content fragments, generate the following three files, respectively,
Extract this section to generate head.html
<title>Untitled Document</title>
Extract this section to generate index.html
Extract this section to generate foot.html
Reply to discussion (solution)
$s =<<< HTML
Untitled Document
Html;preg_match_all ('/.*?
/is ', $s, $r);p rint_r ($r [0]);
Get
Array ( [0] = =
Untitled Document
[1] = =
[2] = =
)
Write to File
$FN = Array (' head.html ', ' index.html ', ' foot.html '); foreach ($r [0] as $i = + $s) file_put_contents ($fn [$i], $s);
$s =<<< HTML
Untitled Document
HTML; $ar = Preg_split ("/(
\s+|\r?\n\s\r?\n)/S", $s,-1, Preg_split_no_empty | preg_split_delim_capture); $d = Array (php_eol. "
,"
. Php_eol), foreach ($ar as $i = + $v) { if ($i) echo $d [$i%2]; echo $v;} echo $d [0];
Untitled Document