PHP的Parse error: syntax error, unexpected T_VARIABLE in 是什么意思?

<?php
function getRelativePath($a,$b) {
$returnPath = array(dirname($b));
$arrA = explode('/', $a);
$arrB = explode('/', $returnPath[0]);
for ($n = 1, $len = count($arrB); $n < $len; $n++) {
if ($arrA[$n] != $arrB[$n]) {
break;
}
}
if ($len - $n > 0) {
$returnPath = array_merge($returnPath, array_fill(1, $len - $n, '..'));
}

$returnPath = array_merge($returnPath, array_slice($arrA, $n));
return implode('/', $returnPath);
}
$a="/a/b/c/d/e.php";
  $b="/a/b/12/34/c.php";
echo getRelativePath($a, $b);
?>
------------------
这个程序运行出错,提示:
Parse error: syntax error, unexpected T_VARIABLE in D:\lamp\wamp\www\text\text1.php on line 19

请问是哪里错了?应该如何修改?

$a="/a/b/c/d/e.php";
  $b="/a/b/12/34/c.php";
echo getRelativePath($a, $b);
?>
这几行有些特殊的字符,你可能是从网页上面copy下来的
你把这几行的空白字符全部删除,或者直接copy下面的代码就可以:
$a="/a/b/c/d/e.php";
$b="/a/b/12/34/c.php";
echo getRelativePath($a, $b);
?>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-02-28
你这个程序到底是要干啥的 ?