使用C ++扩展PHP? [英] Extending PHP with C++?

查看:139
本文介绍了使用C ++扩展PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个性能密集的例程,用PHP编写,我想移植到C ++的性能提升。有什么办法编写一个插件或扩展或某事使用C + +和PHP接口?无需手动编辑实际的PHP源码

I have a performance intensive routine that is written in PHP that I'd like to port to C++ for a performance increase. Is there any way to write a plugin or extension or something using C++ and interface with it from PHP? WITHOUT manually editing the actual PHP source?

推荐答案

我已经在C ++中编写了一个PHP插件, http://www.swig.org/ =nofollow> SWIG 。它是可行的,但它可能需要一段时间才能习惯于SWIG编译周期。您可以从 PHP的SWIG文档开始。

I've written a PHP plugin in C++ with the help of SWIG. It's doable, but it may take a while to get used to the SWIG-compilation cycle. You can start with the SWIG docs for PHP.

更新

正如@therefromhere所述,我极力建议您取得扩展和嵌入PHP 。几乎没有文档在网上找到(至少有没有在2008年底,2009年初,当我做我的PHP插件)。我不得不依靠这本书的一切。虽然有时Google代码搜索有助于查找示例代码。

Update
As @therefromhere has mentioned, I greatly recommend that you get the book Extending and Embedding PHP. There is almost no documentation to be found online (at least there wasn't in late 2008, early 2009 when I did my PHP plugin). I had to rely on the book for everything. Although sometimes Google Code Search is helpful for finding sample code.

这篇关于使用C ++扩展PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆