Word文書を作成する小さなコードを書きましたが、次のエラーが発生しました
require_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); グローバル $user;
$fp = fopen("test.doc", 'w+');
$str = "<B>This is the text for the word file created through php programming</B><br>test to create a doc file from php";
ob_start();
include('index.php');
$result = ob_get_clean();
fwrite($fp, $result);
echo "executed";
header("Content-Disposition: attachment; filename=test.doc"); header("Content-Type: アプリケーション/強制ダウンロード"); header("Content-Length: " .filesize("test.doc")); header("接続: 閉じる");
fclose($fp);
?> 警告: ヘッダー情報を変更できません - ヘッダーは既に /var/www/www.example.com/htdocs/ の (/var/www/www.example.com/htdocs/test_createdoc.php:6 で開始された出力) によって通信されています19 行目の test_createdoc.php。 20 行目の .com/htdocs/test_createdoc.php。 www/www.example.com/htdocs/test_createdoc.php 行 21。 ) /var/www/www.example.com/htdocs/test_createdoc.php の 22 行目
PHPタグ間の空白も削除しました