douche1936 2014-10-14 11:37
浏览 64

如何从php调用c ++函数?

I have a c++ program which has to return a string. Since the main method in C++ cannot return a string, I am returning the string through a user-defined function. How can I invoke this function from my php script. I know exec() command can call a C++ program but is there a way I can call a specific function?

scenario:

int main()
{
   string myfunc(){
      ....
      return string;
   }
   return 0;
}

How can I call the myfunc() from PHP?

  • 写回答

1条回答 默认 最新

  • dongpuchao1680 2014-10-14 11:42
    关注

    You can use C++ PHP bridge library.

    Check this link

    http://www.php-cpp.com/

    And another extension from zend,

    Check this link http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/

    This will help you

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题