Home php教程 php手册 PHP 和 COM

PHP 和 COM

Jun 13, 2016 pm 12:46 PM
com dll php win32 create Can and object I operate of


PHP 可以操作 Win32 平台下的 COM 和 DCOM 对象 1. 我创建了一个DLL来计算一些东西. 有什么方法可以在 PHP 下运行这个DLL吗 ? 2. 'Unsupported variant type: xxxx (0xxxxx)' 是什么意思 ? 3. PHP 里操作可视化对象可能吗? 4. 我可以把COM 对象存诸到 session里吗 ? 5. 我怎样捕获 COM 错误 ? 6. 我怎样在 PHP 里生成DLL文件,就象我在 Perl 里做的一样? 7. 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' 是什么意思 ? 8. 我怎样从远程服务器运行 COM 对象? 9. 我得到消息: 'DCOM is disabled in C:\path...\scriptname.php on line 6', 我应该怎么办 ? 10. 在 PHP页面里可以加载 ActiveX 对象吗 ? 11. 可不可以得到一个COM运行时的实例 ? 12. 有没有办法可以处理从 COM 对象送出的事件 ? 13. 我在调用一个 COM 对象(有多个接口)的方法时出错, . 我应该怎么办? 14. PHP 可以 COM工作, 那么 COM+呢 ? 15. PHP 可以操作 COM 对象, 我们是否可以设想通过 MTS 管理组件资源, 从而管理 PHP ?
1. 我创建了一个DLL来计算一些东西. 有什么方法可以在 PHP 下运行这个DLL吗 ?
你不能在PHP里操作简单的DLL.如果这个DLL包含COM服务器并实现了 IDispatch 接口,你可以操作它.
2. 'Unsupported variant type: xxxx (0xxxxx)' 是什么意思 ?
有很多 VARIANT 类型和它们的集合. 绝大多数已经被支持,可是还有少数不支持.数组也不完全支持,只有一维数组才被支持. 如果你还发现不支持的数据类型:请送 bug 报告(如果还没有报告) 并且提供尽可能多的信息.
3. PHP 里操作可视化对象可能吗?
通常是可以的.但是 PHP 多是用来作为脚本运行在web 服务器设备下, 而可视化对象从来不会出现在服务器桌面. 如果你使用PHP 作为应用程序脚本如 PHP-GTK ,那么通过 COM操作可视化对象是没有限制的.
4. 我可以把COM 对象存诸到 session里吗 ?
不可以. COM 实例被认为是资源.因此它们只能在单一的脚本程序里起作用.
5. 我怎样捕获 COM 错误 ?
当前没有其它工具可以追踪 COM 错误,除了 PHP 自已 (@, track_errors, ..), 我们正在考虑实现它的一种方法.
6. 我可以在 PHP 里生成DLL文件,就象我在 Perl 里做的一样?
不可以.不幸的是没有任何这样的PHP工具.
7. 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' 是什么意思 ?
这个错误有多方面的原因:

CLSID号是错误的
找不到COM所在的DLL
组件没有实现 IDispatch 接口

8. 我怎样从远程服务器运行 COM 对象 ?
就象你运行本地对象一样. 你仅仅需要把远程的IP地址作为第二个参数传给 COM 构造器.
还要确认你的 php.ini文件里com.allow_dcom=true .
9. 我得到消息: 'DCOM is disabled in C:\path...\scriptname.php on line 6', 我应该怎么办 ?
编辑 php.ini文件,设置 com.allow_dcom=true.
10. 在 PHP页面里可以加载 ActiveX 对象吗 ?
这应该与PHP无关. ActiveX 是客户端对象 ,由HTML 页面调用. 和 PHP 脚本没有直接关系. 当然,也没有直接的服务端交互的可能.
11. 可不可以得到一个COM运行时的实例 ? ?
用monikers可以实现这个功能. 你想得到同一个Word实例的多个引用,可以用下面的代码: that instance like shown: $word = new COM("C:\docs\word.doc");
如果没有Word的实例在运行,它会创建新的实例.否则,它会返回它的句柄.
12. 有没有办法可以处理从 COM 对象送出的事件 ?
还不能.
13. 我在调用一个 COM 对象(有多个接口)的方法时出错, . 我应该怎么办?
答案简单得让人不满意. 我不是太清楚,但我想你不用做什么. 如果还有人关于这有一些情况和看法,请让 我(harald.radi@nme.at) 知道 :)
14. PHP 可以 COM工作, 那么 COM+呢 ?
COM+ 扩展了 COM 框架,用来通过MTS 和 MSMQ管理 组件.没有什么特殊的东西PHP不支持.
15. PHP 可以操作 COM 对象, 我们是否可以设想通过 MTS 管理组件资源, 从而管理 PHP ?
PHP 本身还不能处理交易. 也就是说如果有错误发生它还是不会主动滚回. 即使用支持交易的组件对象,你还是要 自己实现交易的管理. (交易 - transactions) 

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
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)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles