0

私は以下のようなPHPコードを持っています:

<?php
    $htmlFile = file_get_contents(http://archi-graphi.com/arcancianev/sejour-29-eau_turquoise_en_corse.html');
    $pdfHtml = ('pdfFile.html');
    copy($htmlFile, $pdfHtml);
        // Now you can choose to run a check to see if the new copy exists,
        // or you have the option to do nothing and assume it is made
        if (file_exists($pdfHtml)) {
            echo "Success :  has been made";
        } else {
            echo "Failure:  does not exist";
        }
?>

しかし、エラーの原因Warning: copy( <!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8" /> <title>Vacances Arcanciane</title> ...がわからないエラーメッセージが表示されました。誰か助けてください、ありがとう。

4

2 に答える 2

3

私が間違っている場合は修正してください。ただし、おそらくcopyではなくfile_put_contentsを探しているでしょう。

<?php
    $html = file_get_contents('http://archi-graphi.com/arcancianev/sejour-29-eau_turquoise_en_corse.html');
    $pdfHtml = 'pdfFile.html';

    // this is probably what you're trying to do
    file_put_contents($pdfHtml, $html);

        // Now you can choose to run a check to see if the new copy exists,
        // or you have the option to do nothing and assume it is made
        if (file_exists($pdfHtml)) {
            echo "Success :  has been made";
        } else {
            echo "Failure:  does not exist";
        }
?>
于 2013-01-23T03:03:59.423 に答える