开发者

How can call a PHP function from Perl code?

开发者 https://www.devze.com 2023-01-06 19:07 出处:网络
I have a function written in PHP and would like to call this inside a CGI script. Is there any direct way to do this?

I have a function written in PHP and would like to call this inside a CGI script. Is there any direct way to do this?

I am not sure if its even possible. The CGI script will be inside cgi-bin directory 开发者_开发百科and the PHP function will be outside this folder.


I guess you could try to use Inline::Interp or PHP, however, I am not sure I see the point, given the overhead involved in invoking yet another interpreter in a CGI script.


have you tried via Command Line like so:

open DATA, "/path/to/you/bin/php you_script.php |" or die "Whoops: $!";


Try to use PHP::Interpreter :

use PHP::Interpreter;
my $p = PHP::Interpreter->new();
$p->include("some_php_include.php");
my $val = $p->somePhpFunc($perlVal);
0

精彩评论

暂无评论...
验证码 换一张
取 消