我以前没用过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';
?>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是这样的:
Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /home/PEAR/Math_Matrix-0.8.0/Matrix.php on line 272
Run Code Online (Sandbox Code Playgroud)
我真的不确定该怎么做.我想我能想到的解释是:
要安装它,我做了以下事情:
pear install --alldeps channel://pear.phpunit.de/PHPUnit
pear install --alldeps channel://pear.php.net/Math_Vector-0.6.2
pear install Math_Matrix
Run Code Online (Sandbox Code Playgroud)
从[Math_Matrix](http://pear.php.net/package/Math_Matrix主页)我可以看到它最后一次更新是在2003年.从那时起,PHP添加了clone关键字,它与clone()Matrix中定义的函数冲突.PHP.
你需要更新Matrix.php - 用"clone2"搜索和替换"clone"应该这样做.