本文整理汇总了PHP中base::response_valid方法的典型用法代码示例。如果您正苦于以下问题:PHP base::response_valid方法的具体用法?PHP base::response_valid怎么用?PHP base::response_valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base
的用法示例。
在下文中一共展示了base::response_valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response_valid
/**
* Check question's form data for valid response. Override this is type has specific format requirements.
*
* @param object $responsedata The data entered into the response.
* @return boolean
*/
public function response_valid($responsedata)
{
if (isset($responsedata->{'q' . $this->id})) {
return $responsedata->{'q' . $this->id} == '' || is_numeric($responsedata->{'q' . $this->id});
} else {
return parent::response_valid($responsedata);
}
}
示例2: response_valid
/**
* Check question's form data for valid response. Override this is type has specific format requirements.
*
* @param object $responsedata The data entered into the response.
* @return boolean
*/
public function response_valid($responsedata)
{
if (isset($responsedata->{'q' . $this->id}) && strpos($responsedata->{'q' . $this->id}, 'other_') !== false) {
// False if "other" choice is checked but text box is empty.
return !empty($responsedata->{'q' . $this->id . '' . substr($responsedata->{'q' . $this->id}, 5)});
} else {
return parent::response_valid($responsedata);
}
}