用反斜线"\"将尖括号等php符号变为引用,参考:
http://cn.php.net/manual/zh/language.references.spot.php
主要参考该手册中这个例子:
[php]
<?php
class y {
public $d;
}
$A = new y;
$A->d = 18;
echo "Object \$A before operation:\n";
var_dump($A);
$B = $A; // This is not an explicit (=&) reference assignment,
// however, $A and $B refer to the same instance
// though they are not equivalent names
$C =& $A; // Explicit reference assignment, $A and $C refer to
// the same instance and they have become equivalent
// names of the same instance
$B->d = 1234;
echo "\nObject \$B after operation:\n";
var_dump($B);
echo "\nObject \$A implicitly modified after operation:\n";
var_dump($A);
echo "\nObject \$C implicitly modified after operation:\n";
var_dump($C);
// Let's make $A refer to another instance
$A = new y;
$A->d = 25200;
echo "\nObject \$B after \$A modification:\n";
var_dump($B); // $B doesn't change
echo "\nObject \$A after \$A modification:\n";
var_dump($A);
echo "\nObject \$C implicitly modified after \$A modification:\n";
var_dump($C); // $C changes as $A changes
?>
[php]
我没有验证过,你可以试试。