1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| function callback($matches)
{
$nb2 = 0;
$m1 = $matches[1];
$m2 = $matches[2];
$m3 = $matches[3];
fwrite(fopen($_SERVER['DOCUMENT_ROOT']."/consult/toto1", "w+"), $m1);
fwrite(fopen($_SERVER['DOCUMENT_ROOT']."/consult/toto2", "w+"), $m2);
fwrite(fopen($_SERVER['DOCUMENT_ROOT']."/consult/toto3", "w+"), $m3);
$p = "#</table>(.*)<table[^>]*>#Us";
$m2 = preg_replace($p,'\\1',$m2, -1, $nb2);
$m = $m1.$m2.$m3;
fwrite(fopen($_SERVER['DOCUMENT_ROOT']."/consult/toto", "w+"), $m);
return $m;
}
$patterns = "#(.+<table[^>]*>)(.+)(</table>*)#s";
$_SESSION['contents'] = preg_replace_callback($patterns,"callback",$_SESSION['contents']); |
Partager