从PHP调用C / C ++库函数 [英] Calling C/C++ library function from PHP

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

问题描述

我们有一个在客户机器上运行的PHP Web应用程序。对于更新,我们在C中有一些代码,我们希望将其与PHP Web应用程序一起作为本机不透明库。

We have a PHP web app running on a customer's machine. For an update, we have a bit of code in C that we'd like to include as a native opaque library along with the PHP web app.

关于调用C / C ++ lib。函数从PHP?

How does one go about calling a C/C++ lib. function from PHP?

不能假定由web服务器调用的PHP应用程序具有调用exec(),eval()或system()的任何类型的权限。类型的函数来执行C包装驱动程序,而C包装驱动程序又使用C / C ++库,因此它需要是从PHP代码中直接使用C库。

It cannot be assumed that the PHP app, called by the web server, has any sort of permission to call an exec(), eval(), or system() type of function to execute a C wrapper driver which in turn uses the C/C++ library, so it would need to be a direct C library use from within the PHP code.

推荐答案

看看一些关于扩展写作的Zend教程,特别是在PHP扩展中包装C ++类

Take a look at some of the Zend tutorials on Extension writing, this one in particular "Wrapping C++ Classes in a PHP Extension"

这篇关于从PHP调用C / C ++库函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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