简体   繁体   English

将Python或Perl与PHP集成

[英]Integrating Python or Perl with PHP

I'm going to help my friend in a improve of his phpBB board, but I want to make somethings there in Python or Perl. 我将帮助我的朋友改进他的phpBB板,但我想在Python或Perl中做些事情。 But it's possible to integrate these languages with PHP? 但是可以将这些语言与PHP集成吗?

You can always call the python or perl interpreter from within PHP! 你总是可以在PHP中调用python或perl解释器! Minimalistic interchange is possible by means of passing command line arguments and capturing stdout ( exec or passthru are related php functions). 通过传递命令行参数和捕获stdout( execpassthru是相关的php函数),可以实现简单的交换。

However, I don't think its's a good idea - using two interpreters instead of one doubles the overall runtime overhead and startup time. 但是,我不认为它是一个好主意 - 使用两个解释器而不是一个解释器整体运行时开销和启动时间加倍。

I'd say that the only reasonable way of doing that is if you are making a separate service, that you talk to via Ajax or XML or something like that. 我要说的唯一合理的方法是,如果你正在制作一个单独的服务,你通过Ajax或XML或类似的东西进行交谈。 Everything else is more trouble than it's worth. 其他一切都比它的价值更麻烦。

Perl PECL包可以将Perl集成到PHP中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM