Home php教程 php手册 PHP终结篇:继续冒险历程

PHP终结篇:继续冒险历程

Jun 21, 2016 am 09:02 AM
com excel php windows word

 

如果你喜欢冒险,并且在Windows上运行CGI、ISAPI或Apache模块版本的PHP,那么你就可以访问COM的函数。好了,详细解释COM的工作就交给微软和许多大部头的书了,为了能简单地了解一下COM的功能,下面是一小段常见的脚本。

  这段PHP脚本将在系统后端启动微软的字处理软件Word,并打开一个新的文档,然后输入一些文字,最后保存文档并关闭Word。具体程序如下:

  <?

  // 建立一个指向新COM组件的索引

   = new COM("word.application") or die("Can't start Word!");

  // 显示目前正在使用的Word的版本号

  echo "Loading Word, v. {->Version}<br>";

  // 把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真)

  // to open the application in the forefront, use 1 (true)

  ->Visible = 0;

  // 在Word中创建新的文档

  ->Documents->Add();

  // 在新文档中添加文字

  ->Selection->TypeText("Testing 1-2-3...");

  //把文档保存在Windows临时目录中

  ->Documents[1]->SaveAs("/Windows/temp/comtest.doc");

  // 关闭与COM组件之间的连接

  ->Quit();

  // 在屏幕上显示其他信息

  echo "Check for the file...";

  ?>

  如果你有一个Intranet网站,数据存储在SQL Server中,而用户需要这些数据的Excel格式,我们就可以让PHP运行必要的SQL查询并对输出进行格式化,然后利用COM打开Excel,把数据转化为Excel格式的数据,最后把数据保存在用户的台式机上。

  PHP的专题讲座到此就告一段落了,希望通过这次系列讲座,能让大家对PHP有一个初步的了解与认识,其实,我们所介绍的也只是PHP技术的皮毛而已,我们的冒险才刚刚开始,但是只要我们能充满热情和兴趣,相信不久的将来,大家一定会精通掌握PHP应用开发技术的。




Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

The latest version download of gate.io The latest version download of gate.io Mar 05, 2025 pm 07:51 PM

Need to download the Gate.io app to start your cryptocurrency journey? This guide details the latest version download steps for iOS, Android, and Windows devices. Simply visit the official website, find the download link and select the appropriate option based on your device. For iOS, it will go directly to the App Store, while Android and Windows users will download the APK or installer for manual installation. Once installed, you can launch the app and set up your account to step into the world of cryptocurrency.

How to solve the problem of third-party interface returning 403 in Node.js environment? How to solve the problem of third-party interface returning 403 in Node.js environment? Mar 31, 2025 pm 11:27 PM

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

How to download okx trading platform How to download okx trading platform Mar 26, 2025 pm 05:18 PM

The OKX trading platform can be downloaded through mobile devices (Android and iOS) and computers (Windows and macOS). 1. Android users can download it from the official website or Google Play, and they need to pay attention to security settings. 2. iOS users can download it through the App Store or follow the official announcement to obtain other methods. 3. Computer users can download the client of the corresponding system from the official website. Always make sure to use official channels when downloading, and register, log in and security settings after installation.

What kind of disk-viewing software is used for Bitcoin What kind of disk-viewing software is used for Bitcoin Mar 17, 2025 pm 04:27 PM

Choosing the right Bitcoin market viewing software is crucial, it can help investors grasp market conditions in real time and make smarter investment decisions. This article will guide you how to make a choice, covering personal needs assessment (trading frequency, analysis depth, information needs and budget), software type selection (exchange interface, professional software, market website/APP), core functional considerations (data reliability, chart tools, custom settings, community communication and platform compatibility), and direction recommendations (maturity financial platform, cryptocurrency aggregation platform, community recommendation software). Finally, it is recommended that you try a few more software and compare it to choose the tool that best suits your needs. Please remember that software is only an auxiliary tool, and you must be cautious when investing at your own risk.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How to avoid third-party interfaces returning 403 errors in Node environment? How to avoid third-party interfaces returning 403 errors in Node environment? Apr 01, 2025 pm 02:03 PM

How to avoid the third-party interface returning 403 error in the Node environment. When calling the third-party website interface using Node.js, you sometimes encounter the problem of returning 403 error. �...

See all articles