简短而有趣 - getUserStateFromRequest
可以返回一个数组吗? API 文档似乎不完整?
非常感谢!
最佳答案
Joomla 文档仍然相当有限,但请查看 Joomla 2.5 中 JApplication::的源代码
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none')
{
$cur_state = $this->getUserState($key, $default);
$new_state = JRequest::getVar($request, null, 'default', $type);
// Save the new value only if it was set in this request.
if ($new_state !== null)
{
$this->setUserState($key, $new_state);
}
else
{
$new_state = $cur_state;
}
return $new_state;
}
答案是肯定的,如果你设置它就可以
JRequest::setVar('var1', array(1,2,3), 'default');
JFactory::getApplication->setUserState('var1', array(123));
或者只是将其与请求一起传递
$_GET['var1'] = array(1,2,3);
$_POST['var1'] = array(1,2,3);
关于arrays - Joomla 3.1 getUserStateFromRequest,它会返回一个数组吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17579290/