All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL初学者教程:学会使用SQL UPDATE语句_[SQL Server教程]
(javascript)prototype的一个优势也是缺点_JavaScript技术_编程技术
避免Access和SQL,Server的空值冲突_[SQL,Server教程]
Silverlight,2(beta1)数据操作(7)—调用FlickR,REST,APIs来询图片_[Asp.Net教程]
PHP编程中break及continue两个流程控制指令_php资料_编程技术
WindowsXP下Apache2+PHP5+MySQL5的配置要点_[PHP教程]
javascript,编写的文字放大效果_JavaScript技术_编程技术
编写对SEO友好的ASP.NET程序_[Asp.Net教程]
加速PHP动态网站,MySQL索引分析和优化_php资料_编程技术
ASP.NET防止SQL注入攻击常用方法_[Asp.Net教程]
Reading number is top 10 pictures
哥斯达黎加的门将是如何练成的
The money of more than 100 countries and regions10
Ashlynn Brooke photograph of a group4
网上疯传的一篇小学作文《爸爸也治不了妈妈》
30 beautiful school beauty6
NeedWallpaper9
Summer is most suitable for young people to travel in China10
青涩甜美-王祖贤小时候的旧照片曝光
如果没有好报,为什么要做好人?
恶搞漫画1
Download software ranking
打鸟视频
超级战舰
中国结婚习俗实录
Ashlynn Video2
I for your crazy
Boxer's Top ten classic battle3
Ashlynn Video4
C#与.NET技术平台实战演练
天龙八部最新服务端
电车之狼R
归海一刀 published in(发表于) 2014/2/10 6:50:01 Edit(编辑)
PHP脚本的8个技巧(6)PHP和COM_[PHP教程]

PHP脚本的8个技巧(6)PHP和COM_[PHP教程]

PHP脚本的8个技巧(6)PHP和COM_[PHP教程]

如果你是一名冒险份子,而且你正在使用CGI、ISAPI或Apache模块版本的Windows系统上运行着PHP,那么你也可以获得系统的COM功能。现在,解释COM(微软的组件对象模型)的工作留给了微软和那些大部头的图书来完成。然而,知道点COM也没什么错,下面有一个普通的(没有双关语,针对很普通)代码小片断。

这代码小片断使用PHP在后台启动Microsoft Word、打开一个新文件、键入一些文本、保存该文件然后关闭应用程序:

// create a reference to a new COM component (Word)
word = new COM("word.application") or die("Can't start Word!");

// print the version of Word that's now in use
echo "Loading Word, v. {word->Version}
";

// set the visibility of the application to 0 (false)
// to open the application in the forefront, use 1 (true)
word->Visible = 0;

// create a new document in Word
word->Documents->Add();

// add text to the new document
word->Selection->TypeText("Testing 1-2-3...");

//save the document in the Windows temp directory
word->Documents[1]->SaveAs("/Windows/temp/comtest.doc");

// close the connection to the COM component
word->Quit();

// print another message to the screen
echo "Check for the file...";
?>

假设你正在运行一个内联网Web站点,该站点把数据存放在Microsoft SQL Server数据库内,你的用户需要Excel格式的数据。那么,你可以让PHP执行必要的SQL查询并且格式化输出结果,然后使用COM启动Excel,把数据传输给它,最后再把文件存储到用户的桌面系统内。





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.