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条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失