用PHP编辑Word文档时遇到问题 我想打开word文档并对其进行编辑 我正在从服务器打开word文档,当时它是用垃圾值打开的(可能它没有正确转换为UTF-8) 当我删除这些垃圾值并将文本区域中的某个内容插入到该文件时,它将插入该文件,从那时起,该文件将正常打开 我希望文档打开时使用文档中的英文单词,而不是垃圾值-这只是目前第一个被破坏的打开 Word文档不能像文本文件一样简单地打开
你可以看看这篇文章:。Word文档不能像文本文件一样简单地打开用PHP编辑Word文档时遇到问题 我想打开word文档并对其进行编辑 我正在从服务器打开word文档,当时它是用垃圾值打开的(可能它没有正确转换为UTF-8) 当我删除这些垃圾值并将文本区域中的某个内容插入到该文件时,它将插入该文件,从那时起,该文件将正常打开 我希望文档打开时使用文档中的英文单词,而不是垃圾值-这只是目前第一个被破坏的打开 Word文档不能像文本文件一样简单地打开,php,Php,你可以看看这篇文章:。Word文档不能像文本文件一样简单地打开 你可以看一看这篇文章:。Word文档不仅仅是一个文本文件,所以你不能像写文本文件那样只写它 您还可以看看codeplex上的项目,它是一个用纯PHP编写word文档的库,不需要COM,尽管目前它只支持创建新的word文档。word文档不仅仅是一个文本文件,因此您不能像编写文本文件那样编写它 您还可以看看codeplex上的项目,这是一个用纯PHP编写word文档的库,不需要COM,尽管目前它只支持创建新的word文档 <?
你可以看一看这篇文章:。Word文档不仅仅是一个文本文件,所以你不能像写文本文件那样只写它
您还可以看看codeplex上的项目,它是一个用纯PHP编写word文档的库,不需要COM,尽管目前它只支持创建新的word文档。word文档不仅仅是一个文本文件,因此您不能像编写文本文件那样编写它 您还可以看看codeplex上的项目,这是一个用纯PHP编写word文档的库,不需要COM,尽管目前它只支持创建新的word文档
<?
$filename = 'test.doc';
if(isset($_REQUEST['Submit'])){
$somecontent = stripslashes($_POST['somecontent']);
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened fi<form action="" method="get"></form>le.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename) <a href=".$_SERVER['PHP_SELF']."> - Continue - ";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
} else {
// get contents of a file into a string
$handle = fopen($filename, 'r');
$somecontent = fread($handle, filesize($filename));
?>
<h1>Edit file <? echo $filename ;?></h1>
<form name="form1" method="post" action="">
<p>
<textarea name="somecontent" cols="80" rows="10"><? echo $somecontent ;?></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<?
fclose($handle);
}
?>