之前我没有使用过PEAR,所以我可能会做一些愚蠢的事情。我已经安装了Math_Matrix库,但是当我包含它时,我只是得到一个错误。我的整个代码是:

<?php
  $path = '/home/PEAR/Math_Matrix-0.8.0';
  set_include_path(get_include_path() . PATH_SEPARATOR . $path);
  include_once 'Matrix.php';
?>

我得到的错误是:

Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /home/PEAR/Math_Matrix-0.8.0/Matrix.php on line 272

我不确定该怎么做。我想我能想到的解释是:

  1. 我没有正确安装Math_Matrix库(我在已经安装了PEAR的共享服务器上)或者已经下载了错误的版本。
  2. 在我加入Matrix.php
  3. 之前,我应该包含其他内容
  4. 我包含了错误的文件(或正确的文件名,但路径错误,不知何故)。
  5. 要安装它,我执行了以下操作:

    pear install --alldeps channel://pear.phpunit.de/PHPUnit
    pear install --alldeps channel://pear.php.net/Math_Vector-0.6.2
    pear install Math_Matrix
    
有帮助吗?

解决方案

来自[Math_Matrix]( http://pear.php.net/package/Math_Matrix主页)我可以看到它最后一次更新是在2003年。从那时起,PHP已经添加了 clone 关键字,与Matrix.php中定义的 clone()函数冲突。

您需要更新Matrix.php - 搜索&amp;替换“克隆”与“clone2”一起应该这样做。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top