本文整理汇总了PHP中Answer::Set_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::Set_type方法的具体用法?PHP Answer::Set_type怎么用?PHP Answer::Set_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::Set_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
public function parse()
{
// 定义题型样式
$ap = $this->patterning(array($this->anp, $this->ap, $this->ep), 'umi');
// 处理答案
$answerTextArray = array();
preg_match_all($ap, $this->_sectionText, $answerTextArray);
if (count($answerTextArray) > 0 && count($answerTextArray[0]) > 0) {
$answerTextArray = $answerTextArray[0];
} else {
return null;
}
// 处理答案
$answerArray = array();
foreach ($answerTextArray as $answerText) {
// 拆解每个答案并生成对应的Answer
$answer = new Answer();
$answer->Set_content(ext_trim(preg_replace($ap, '$1', $answerText)));
$answer->Set_type(AnswerType::CORRECTION);
$answer->Set_desc(ext_trim(preg_replace($this->patterning(array($this->anp, $this->ap), 'umi'), '', $answerText)));
$answerArray[] = $answer;
}
// 返回结果
return $answerArray;
}
示例2: parse
public function parse()
{
// 定义题型样式
$ap = $this->patterning(array($this->anp, $this->ap), 'umi');
// 处理答案
$answerTextArray = array();
preg_match_all($ap, $this->_sectionText, $answerTextArray);
if (count($answerTextArray) > 0 && count($answerTextArray[0]) > 0) {
$answerTextArray = $answerTextArray[0];
} else {
return null;
}
// 处理答案
$answerArray = array();
foreach ($answerTextArray as $answerText) {
// 拆解每个答案并生成对应的Answer
$answer = new Answer(true);
$answerText = preg_replace($this->patterning($this->anp), '', $answerText);
$subAnswerTextArray = array();
$subAnswerTextArray = preg_split($this->patterning($this->sas), $answerText);
foreach ($subAnswerTextArray as $subAnswerText) {
$subAnswer = new Answer();
$subAnswer->Set_content(ext_trim($subAnswerText));
$subAnswer->Set_type(AnswerType::SHORT_ANSWER);
$subAnswers =& $answer->Get_answers();
$subAnswers[] = $subAnswer;
}
$answer->Set_type(AnswerType::SHORT_ANSWER);
$answerArray[] = $answer;
}
// 返回结果
return $answerArray;
}
示例3: parse
public function parse()
{
// 定义题型样式
$ap = $this->patterning($this->ap, 'usi');
// 处理答案
$answerTextArray = array();
preg_match_all($ap, $this->_sectionText, $answerTextArray);
if (count($answerTextArray) > 0 && count($answerTextArray[0]) > 0) {
$answerTextArray = $answerTextArray[0];
$cp = $this->patterning($this->mp, 'usi');
for ($i = 0; $i < count($answerTextArray); $i++) {
$answerTextArray[$i] = preg_replace(array($cp, '/^\\s*|\\s*$/s'), '', $answerTextArray[$i]);
}
} else {
return null;
}
// 处理答案
$answerArray = array();
foreach ($answerTextArray as $answerText) {
// 拆解每个答案并生成对应的Answer
$answer = new Answer();
$answer->Set_content($answerText);
$answer->Set_type(AnswerType::OTHERS);
$answerArray[] = $answer;
}
// 返回结果
return $answerArray;
}
示例4: parse
public function parse()
{
// 定义题型样式
$ap = $this->patterning($this->ap, 'usi');
// 处理答案
$answerTextArray = array();
preg_match_all($ap, $this->_sectionText, $answerTextArray);
if (count($answerTextArray) > 0 && count($answerTextArray[0]) > 0) {
$answerTextArray = $answerTextArray[0];
} else {
return null;
}
// 处理答案
$answerArray = array();
foreach ($answerTextArray as $answerText) {
// 拆解每个答案并生成对应的Answer
$answer = new Answer();
$answer->Set_content($answerText);
$answer->Set_type(AnswerType::MULTIPLE_CHOICE);
$answerArray[] = $answer;
}
// 返回结果
return $answerArray;
}