调用PHP从C [英] Calling PHP From C

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

问题描述

我想写将使用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.

推荐答案

这本书的萨拉Golemon的(扩展和嵌入PHP 亚马逊的有一个关于在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()
  命令。

In addition to loading external scripts, as you saw in the last chapter, your PHP embedding application can also execute smaller snippets of arbitrary code using the underlying function that implements the familiar userspace eval() command.

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

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