2011-10-12 46 views
0

我试着去使用功能,我把在如何使用遥控器的功能在不同的服务器

我已经启用allow_url_fopen选项远程服务器

现在在测试阶段,即时通讯在我的本地服务器做这个(毫安)和allow_url_include在php.ini文件

在remote.php(在远程服务器上),我有测试此代码:

function test(){ 
echo 'testing calling remote function'; 
} 

,并在我的本地服务器,我有这个代码:

require_once('http://remoteserver.com/remote.php') 

test(); // calling test function in remote.php 

但我的一切是错误调用未定义功能

我在正确的方式和错误的方式这样做呢?

有没有办法做到这一点?

回答

1

当您做require_once('http://remoteserver.com/remote.php')时,您包含的内容是http://remoteserver.com/remote.php的输出,而不是此脚本的php源代码。

+0

所以,基本上我不能调用远程文件内的功能? – s3polz

+0

是的,除非你可以让romote服务器回应出php源代码。 – xdazz

+0

哦,我看到了.. 这样就意味着,这种方法只能用于回显远程文件中的内容。 现在我明白了。 :) – s3polz