我正在使用 Joomla 2.5。
第一种方法
JFactory::getSession()->set('mymessage', 'here is some message text');
第二种方法
$session = JFactory::getSession();
$session->set('mymessage', 'here is some message text');
我在构造函数中使用了上述方法(1 或 2)。所以我想优化 PHP 代码,因为它会在执行过程中被多次调用。我想知道的是哪种方法有效且高效?
谢谢