当前位置: 首页>>代码示例>>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;未经允许,请勿转载。