问题
i need to save contents of webpage on word. i need to keep the links and formating too. if i send
$ter=$ter. "<a href='$url'>".$chunk."</a> ";
$fp = fopen("test.doc", 'w+');
$str = $ter;
fwrite($fp, $str);
fclose($fp);
i get a word document but i loose the links ..it comes out as
a href='http://www.google.com/search?q=sells+sea+shells%0D%0A'>sells sea shells
回答1:
Going along with this weird pretend ".doc" file which Word (2007) does seem to display as a document; if I change your fwrite line:
fwrite($fp, '<html><body>' . $str . '</body></html>');
It works.
回答2:
You may wan't to read a related Question here at Stack Overflow. I think you will find a lot of useful information here:
Create Word Document using PHP in Linux
来源:https://stackoverflow.com/questions/4415729/how-can-i-save-content-of-current-webpage-in-word-through-php