问题描述
我想写将使用PHP作为脚本语言的应用程序。应用程序是一个CGI处理程序,我希望能够调用它从PHP页面。
I am trying to write an application that will use PHP as a scripting language. The application is a CGI handler, and I want to be able to call PHP pages from it.
我要寻找code,这将让我初始化C程序中的PHP,然后通过它要么包含PHP code或文件名,它解析缓冲区。我想借此从输出,并能够通过在CGI程序的功能来运行它。
I am looking for code that will let me initialize PHP inside the C program and then pass it either a buffer containing the php code, or a filename, for it to parse. I want to take the output from that and be able to run it through a function in the CGI program.
推荐答案
这本书的的)的有一个关于在C PROGRAMM嵌入PHP,这您可能感兴趣的章节。
The book Extending and Embedding PHP by Sara Golemon (amazon) has a chapter about embedding PHP in a C programm, which might interest you.
如果你想有一个preVIEW,从我记得,有些页面是avaible在谷歌的书籍,例如。
If you want a preview, from what I remember, some pages are avaible on Google books, for instance.
结果
这里有一个快速报价的(从第20章的开头。)的:
在除加载外部
脚本,您在上次见到
章中,你的PHP嵌入
应用程序还可以执行更小
使用任意code的片段
底层函数实现
熟悉的用户空间的eval()
命令。
这篇关于调用PHP从C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!