$strNameOfStrategyClass::staticMethod();
但它给出了T_PAAMAYIM_NEKUDOTAYIM.
$> cat test.PHP <? interface strategyInterface { public function execute(); public function getLog(); public static function getFormatString(); } class strategyA implements strategyInterface { public function execute() {} public function getLog() {} public static function getFormatString() {} } class strategyB implements strategyInterface { public function execute() {} public function getLog() {} public static function getFormatString() {} } class implementation { public function __construct( strategyInterface $strategy ) { $strFormat = $strategy::getFormatString(); } } $objImplementation = & new implementation("strategyB") ; $> PHP test.PHP Parse error: Syntax error,unexpected T_PAAMAYIM_NEKUDOTAYIM in /var/www/test.PHP on line 24 $> PHP -v PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 4 2010 03:25:57)
这会在5.3中有效吗?