我们被要求在新网站上支持一些相当旧的Perl表单,因为我们正在使用基于PHP的CMS,我们需要将Perl脚本包含到我们的新CMS中。
We've been asked to support some rather old Perl forms on a new site, as we're using a PHP based CMS we need to include the Perl scripts into our new CMS.
我尝试过一些shell_exec但是已经禁用了。有没有人有任何想法?
I've tried a bit of shell_exec but that's disabled. Has anyone got any ideas?
推荐答案Perl扩展
有一个可用于PHP的Perl扩展。
Perl extension
There is a Perl extension available for PHP.
Zend开发人员专区的一篇文章详细介绍了它这里。
An article from the Zend developer zone details it here.
该扩展程序允许您:
- 加载并执行Perl文件
- 评估Perl代码
- 访问Perl变量
- 调用Perl函数
- 实例化Perl对象
- 访问Perl对象的属性
- 调用Perl对象的方法
- load and execute Perl files
- evaluate Perl code
- access Perl variables
- call Perl functions
- instantiate Perl objects
- access properties of Perl objects
- call methods of Perl objects
您可以使用以下命令从CVS获取它:
You can obtain it from CVS using this command:
$ cvs -d :pserver:cvs.php:/repository co pecl/perl此处列出了运行Perl脚本的示例:
An example of running a Perl script is listed here:
print "Hello from Perl! "示例1(test1.php)
Example 1 (test1.php)
<?php print "Hello from PHP! "; $perl = new Perl(); $perl->require("test1.pl"); print "Bye! "; ?>更多推荐
如何将Perl脚本的输出包含到PHP页面中?
发布评论