[提问]PHP 读取 word COM 组件的错误信息 我很是无语啊
<?php// 建立一个指向新COM组件的索引 $word = new COM("word.application") or die("Can't start Word!"); //打开一个文档 $word->Documents->OPen("F:/wamp/www/oa/111.doc"); //读取文档内容 $test= $word->ActiveDocument->content->Text; echo $test; echo "<br>"; //将文档中需要换的变量更换一下$test=str_replace("<{变量}>","这是变量",$test);echo $test;$word->Documents->Add(); // 在新文档中添加文字 $word->Selection->TypeText("$test"); //把文档保存在目录中 $word->Documents[1]->SaveAs("F:\wamp\www\oa\111.doc"); // 关闭与COM组件之间的连接 $word->Quit(); ?>
IE 浏览器下的错误报告
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 尚未调用 CoInitialize。 ' in F:\wamp\www\oa\newfile.php:3 Stack trace: #0 F:\wamp\www\oa\newfile.php(3): com->com('word.applicatio...') #1 {main} thrown in F:\wamp\www\oa\newfile.php on line 3
遨游下的错误报告
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': 尚未调用 CoInitialize。 ' in F:\wamp\www\oa\newfile.php:3 Stack trace: #0 F:\wamp\www\oa\newfile.php(3): com->com('word.applicatio...') #1 {main} thrown in F:\wamp\www\oa\newfile.php on line 3
我求解释
回复讨论(解决方案)
早上开机 测试第一次 完全可以没有问题 换在一个word的名称 在测试 又开始报错了
应该是第一个实例没有关闭
早上开机 测试第一次 完全可以没有问题 换在一个word的名称 在测试 又开始报错了
不好意思 没有听懂
都是一样的代码啊
应该是第一个实例没有关闭
不好意思 没有听懂
都是一样的代码啊
问题出你的第三行啊。还是致命错误。 "F:/wamp/www/oa/111.doc 与 F:\wamp\www\oa\111.doc 你这个路径不是有问题吗? 仔细检查。
怎么我编辑的结果是地14行出错啊?
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: ???û?д

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
