4
繼此guide來消毒我的投入,我想知道是否一個空字符串覆蓋這個?Joomla檢查空字符串與JInput
$jinput = JFactory::getApplication()->input;
$this->name = $jinput->get('name', '', 'STRING');
通常沒有Joomla我會檢查一個空字符串以及。喜歡的東西:
if (!empty($_POST['name']))
望着JInput get方法我看到,它會檢查它是否isset
:
public function get($name, $default = null, $filter = 'cmd')
{
if (isset($this->data[$name]))
{
return $this->filter->clean($this->data[$name], $filter);
}
return $default;
}
不一樣的事情,因爲isset
只會檢查空。但是,這是使用get方法的默認值。所以如果我爲這個第二個參數指定一個空字符串,我在這裏覆蓋了嗎?
$this->name = $jinput->get('name', '', 'STRING');