0

我想从另一台服务器的 Mage.php 文件(Magento)调用 getVersion() 到我的服务器。我已使用以下代码执行相同但不工作:

$ftp_server = "server_name";
$ftp_user_name = "user_name";
$ftp_user_pass = "password";

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 

// login with username and password
if (ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)) {
    echo "Connected as $ftp_user@$ftp_server\n";
} else {
    echo "Couldn't connect as $ftp_user\n";
}

// call function
require_once 'app/Mage.php';
echo Mage::getVersion();

我可能认为使用 require() 调用文件有一些错误。还有一些函数,如 ftp_nb_fget()、ftp_nb_get() 和 ftp_get(),但用于读取和下载文件,而不是执行文件内的函数。

有没有其他方法可以实现这一点,或者我的代码中遗漏了一些东西?请尽快帮助我。

4

0 回答 0