txt、doc文件提交内容到textarea里面怎么做? txt、doc文件提交内容到textarea里面怎么做?就是有txt、doc文件,然后想在页面上做一个按钮,点这个按钮就选择txt或者doc文件,把这些文件的内容读到textarea里面,再由textarea提交到数据库,这个代码怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 通过file_get_contents()获取文本内容,显示在textarea即可。 <? // 建立一个指向新COM组件的索引 $word = new COM(”word.application”) or die(”Can’t start Word!”); // 显示目前正在使用的Word的版本号 //echo “Loading Word, v. {$word->Version}<br>”; // 把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真) // to open the application in the forefront, use 1 (true) //$word->Visible = 0; //打?一个文档 $word->Documents->OPen(”d:\myweb\muban.doc”); //读取文档内容 $test= $word->ActiveDocument->content->Text; echo $test; echo “<br>”; //将文档中需要换的sexinsex变量更换一下 $test=str_replace(”<{变量}>”,”这是变量”,$test); echo $test; $word->Documents->Add(); // 在新文档中添加文字 $word->Selection->TypeText(”$test”); //把文档保存在目录中 $word->Documents[1]->SaveAs(”d:/myweb/comtest.doc”); // 关闭与COM组件之间的连接 $word->Quit(); ?> $file = fopen ("http://"localhost/ttt.word", "r"; if (!$file) { echo "<p>;Unable to open remote file.\n"; exit; } while (!feof ($file)) { $line .= fgets ($file, 4096); } echo $line; fclose($file); php读取word,txt,excel…… <form><textarea name="Phone" id="phone" style="margin-top:5px; width:310px;" cols="25" rows="15"></textarea><input type="file" name="fileName" id="fileName"><input name="buttonId" name="buttonId" type="button" value="提交"></form>怎么结合你给的这代码 给你一个思路:1)你看下file_get_content()和fopen()函数,二者可选择一个,怎么把txt和word读取出来。2)怎么把读取的值再绑定到textarea。你研究下。 关于SMTP服务器架设的问题??? 求教POST过来的变量和逗号在select语句里的写法 读取 excel 日语数据时 出现乱码 如何解决啊? 求vn700等各大高手!求助PHP正则! 抓取网页数据提交到库 怎么用PHP做实时查询的曲线图 mysql4.1以下版本不支持嵌套查询? 变量与数组的简单问题!急100分 求好用的Zend Encode,我在站长站下的不好用,说我那个授权无效呀 如何实现不是连续网页的变量传递? php初学者,thinkphp写数据库问题 smarty分配的变量为什么在模板上输出不了?
// 建立一个指向新COM组件的索引
$word = new COM(”word.application”) or die(”Can’t start Word!”);
// 显示目前正在使用的Word的版本号
//echo “Loading Word, v. {$word->Version}<br>”;
// 把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真)
// to open the application in the forefront, use 1 (true)
//$word->Visible = 0;
//打?一个文档
$word->Documents->OPen(”d:\myweb\muban.doc”);
//读取文档内容
$test= $word->ActiveDocument->content->Text;
echo $test;
echo “<br>”;
//将文档中需要换的sexinsex变量更换一下
$test=str_replace(”<{变量}>”,”这是变量”,$test);
echo $test;
$word->Documents->Add();
// 在新文档中添加文字
$word->Selection->TypeText(”$test”);
//把文档保存在目录中
$word->Documents[1]->SaveAs(”d:/myweb/comtest.doc”);
// 关闭与COM组件之间的连接
$word->Quit();
?> $file = fopen ("http://"localhost/ttt.word", "r";
if (!$file) {
echo "<p>;Unable to open remote file.\n";
exit;
}
while (!feof ($file)) {
$line .= fgets ($file, 4096);
}
echo $line;
fclose($file);
<textarea name="Phone" id="phone" style="margin-top:5px; width:310px;" cols="25" rows="15"></textarea>
<input type="file" name="fileName" id="fileName">
<input name="buttonId" name="buttonId" type="button" value="提交">
</form>
怎么结合你给的这代码
1)你看下file_get_content()和fopen()函数,二者可选择一个,怎么把txt和word读取出来。
2)怎么把读取的值再绑定到textarea。
你研究下。