當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Answer::Set_content方法代碼示例

本文整理匯總了PHP中Answer::Set_content方法的典型用法代碼示例。如果您正苦於以下問題:PHP Answer::Set_content方法的具體用法?PHP Answer::Set_content怎麽用?PHP Answer::Set_content使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Answer的用法示例。


在下文中一共展示了Answer::Set_content方法的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;
 }
開發者ID:rcom10002,項目名稱:codeslab,代碼行數:25,代碼來源:answer_correction_processor.class.php

示例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;
 }
開發者ID:rcom10002,項目名稱:codeslab,代碼行數:33,代碼來源:answer_short_answer_processor.class.php

示例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;
 }
開發者ID:rcom10002,項目名稱:codeslab,代碼行數:28,代碼來源:answer_others_processor.class.php

示例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;
 }
開發者ID:rcom10002,項目名稱:codeslab,代碼行數:24,代碼來源:answer_multiple_choice_processor.class.php


注:本文中的Answer::Set_content方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。