0

私のクライアントのサーバーはphpをサポートしておらず、多くの更新が必要なため、ページに.htmlをエクスポートしました。今度は、このページの一部をエクスポートして、別の場所にアップロードしたいと考えています。

2 つの ob_start(); を呼び出すにはどうすればよいですか?

サンプルページのsudoコード

ob_start();  //1 obstart  

<html>
<head></head>
<body>
ob_start();   //2 obstart  
<div class="special"></div>
//stop copying obstart #2
</body>
</html>


$contentString =  ob_get_contents();
$divString =  ob_get_contents();

file_put_contents( 'HTMLFile.html', $contentString ); 
file_put_contents( 'specialDIV.txt', $divString ); 
4

1 に答える 1

0
<?php
ob_start();  //1 obstart  
?>
<html>
<head></head>
<body>
<?php
$contentString =  ob_get_contents();
ob_start();   //2 obstart 
?> 
<div class="special"></div>
//stop copying obstart #2
</body>
</html>

<?php
$divString =  ob_get_contents();

file_put_contents( 'HTMLFile.html', $contentString ); 
file_put_contents( 'specialDIV.txt', $divString ); 
?>
于 2013-10-17T13:56:48.097 に答える