简体   繁体   中英

Session & PHP & Joomla & Code Optimization

I'm using Joomla 2.5.

1st method

JFactory::getSession()->set('mymessage', 'here is some message text');

2nd method

$session = JFactory::getSession();
$session->set('mymessage', 'here is some message text');

I use above methods(1 or 2) in my constructor. So I want to optimize the PHP code since it will be called multiple times during execution. What I want to know is which method is effective and efficient?

Thanks

对于每种方法(1和2),循环10次循环10 000次,并用微量时间计时并计算平均值。

First is un_named session variable call which will avoid $session need and initialization apart from that everything is same. therefore first may have some efficiency over space may be in time also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM