douxiajia6104 2011-07-28 00:49
浏览 82
已采纳

Python PHP和Perl一起使用?

I was reading through Facebook's hiring now job listings and I saw this...

* Competency in Shell, PHP, Perl or Python. C is a plus

This sparked a question in my mind, is it possible to use (for example) python and PHP together?

As in... I write a function in PHP to read a MySQL database and cut the data read into raw string form.

I then use python to use this PHP function to perform operations on this data.

The part where I say "use python to use this PHP function" is this possible?

If so, how? (a small code example would be awesome)

  • 写回答

3条回答 默认 最新

  • doudichu1358 2011-07-28 01:03
    关注

    I think there are two answers.

    The simple answer to this question is to use the exec() function in your PHP scripts to execute python scripts.

    There is also the complicated answer, to either build, or use a prior attempted PHP extension PiP:

    this extensions allows the Python interpretter to be embedded inside of PHP (think of PHP as the parent language with Python as its child). This allows native Python objects to be instantiated and manipulated from within PHP. There is also initial support for accessing PHP functions and data from within the embedded Python

    I'd love to see some examples of it in use.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站