本文整理匯總了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;
}