PHP7 xml_parse()更改,截断数组?
问题描述:
时遇到的问题,在 ATutor QTI ParserPHP7 xml_parse()更改,截断数组?
我希望有人能指出我错过了什么,或者想出一个变通的PHP 7.1.1 xml_parse()函数的功能发生。
我找不到任何文档或帖子,建议将PHP xml_parse()函数从5.6更改为7.1,尽管这两个版本似乎以不同方式解析xml。正在解析的XML出现在下面。
具体而言,在实施例中的问题阵列,30年5月6日返回的问题的阵列,如:
[question] => Array
(
[0] => graphic matching
[1] => LIKERT
[2] => multi choice question
[3] => Mutliple question
[4] => open ended
[5] => ordering
[6] => Simple match
[7] => true
)
虽然用PHP 7.1.1,所有其他条件相同,它只返回第一来自上面每个数组元素的字母,作为一个字符串。
[question] => gLmMooSt
XML文件是来自QTI测试(即测验)包的IMS QTI 1.2.1清单。
发生截断的元素是问题标题(问题本身),可在以下元素中找到,该元素在使用PHP5.6([0] =>图形匹配)时返回为数组中的第一个元素,和使用时返回作为第一个字母, “G”,在问题串PHP7.1.1([问题] => gLmMooSt)
<material>
<mattext texttype="text/html">graphic matching</mattext>
</material>
<?xml version="1.0" encoding="utf-8"?>
<questestinterop
xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_4/ims_qtiasiv1p2_localised.xsd"
>
\t <assessment title="Simple test" ident="d41d8cd98f00b204e9800998ecf8427e">
\t \t <section ident="ATUTOR-8" title="Simple test">
\t \t <!-- matching question with partial marks -->
\t \t <item title="Mathcing question" ident="ITEM_2">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Groups</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Drag-and-drop</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.pattern_match.v0p1</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_weighting</fieldlabel>
<fieldentry>5</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">graphic matching</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t \t \t
\t \t \t \t \t <response_lid ident="RESPONSE-98f13708210194c475687be6106a3b84" rcardinality="Multiple">
\t \t \t \t \t \t <material>
\t \t \t \t \t \t \t <mattext texttype="text/html">a</mattext>
\t \t \t \t \t \t </material>
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option0"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option1"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">B</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t \t \t \t
\t \t \t \t \t <response_lid ident="RESPONSE-3c59dc048e8850243be8079a5c74d079" rcardinality="Multiple">
\t \t \t \t \t \t <material>
\t \t \t \t \t \t \t <mattext texttype="text/html">b</mattext>
\t \t \t \t \t \t </material>
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option0"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option1"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">B</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t \t \t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t </resprocessing>
\t \t \t \t </item>
<!-- likert question (aka multiple choice with no correct answer) -->
\t \t <item title="Multiple choice question" ident="ITEM_1">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Identifier</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Multiple-choice</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.mutliple_choice.v0p1</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">LIKERT</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_lid ident="RESPONSE1" rcardinality="Single">
\t \t \t \t \t \t <render_choice shuffle="No" minnumber="1" maxnumber="1">
\t \t \t \t \t \t \t <flow_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice0"> \t
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A LITTLE</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice1"> \t
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A lot</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t </flow_label>
\t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE1">Choice0</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="que_score" action="Set">0</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE1">Choice1</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="que_score" action="Set">0</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t </resprocessing>
\t \t </item>
<!-- single answer multiple choice question -->
\t \t <item title="Multiple choice question" ident="ITEM_5">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Identifier</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Multiple-choice</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.mutliple_choice.v0p1</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_weighting</fieldlabel>
<fieldentry>5</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">multi choice question</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_lid ident="RESPONSE5" rcardinality="Single">
\t \t \t \t \t \t <render_choice shuffle="No" minnumber="1" maxnumber="1">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice0">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">this is correct</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice1">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">this is wrong</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice2">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">this is wrong</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t \t \t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE5">Choice0</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="que_score" action="Set">5</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t
\t \t \t </resprocessing>
\t \t \t \t </item>
<!-- multi answer multiple choice question with partial marks -->
\t \t <item title="Multiple answer question" ident="ITEM_4">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Identifier</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t <qtimetadatafield>
<fieldlabel>qmd_questiontype</fieldlabel>
<fieldentry>Multiple-response</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.mutliple_response.v0p1</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_weighting</fieldlabel>
<fieldentry>5</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">Mutliple question</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_lid ident="RESPONSE4" rcardinality="Multiple">
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice0">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">coorect</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice1">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">coorect</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice2">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">icorrect</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice3">
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">icorrect</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE4">Choice0</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">5</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE4">Choice1</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">5</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t </resprocessing>
\t \t \t \t </item>
<!-- open ended (free text) question -->
\t \t <item title="Open ended question" ident="ITEM_6">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>String</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>FIB-string</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.fib.v0p1</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_weighting</fieldlabel>
<fieldentry>5</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">open ended</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_str ident="RESPONSE6" rcardinality="Single">
\t \t \t \t \t \t \t \t \t \t \t \t <render_fib rows="1" columns="5">
\t \t \t \t \t \t \t <response_label ident="Choice" />
\t \t \t \t \t \t </render_fib>
\t \t \t \t \t </response_str>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t \t </item>
<!-- ordering question -->
\t \t <item title="Ordering question" ident="ITEM_7">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Identifier</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">ordering</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_lid ident="RESPONSE7" rcardinality="Ordered">
\t \t \t \t \t \t <render_choice shuffle="Yes" minnumber="4" maxnumber="4">
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice0"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">item1</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice1"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">itms2</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice2"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">item 3</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Choice3"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">items 4</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE7">Choice0</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">1.25</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE7">Choice1</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">1.25</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE7">Choice2</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">1.25</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE7">Choice3</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">1.25</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t </resprocessing>
\t \t \t \t </item>
<!-- matching question with partial marks -->
\t \t <item title="Mathcing question" ident="ITEM_3">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Groups</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Drag-and-drop</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_profile</fieldlabel>
<fieldentry>cc.pattern_match.v0p1</fieldentry>
</qtimetadatafield>
<qtimetadatafield>
<fieldlabel>cc_weighting</fieldlabel>
<fieldentry>5</fieldentry>
</qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">Simple match</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t \t \t
\t \t \t \t \t <response_lid ident="RESPONSE-34173cb38f07f89ddbebc2ac9128303f" rcardinality="Multiple">
\t \t \t \t \t \t <material>
\t \t \t \t \t \t \t <mattext texttype="text/html">A</mattext>
\t \t \t \t \t \t </material>
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option0"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option1"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">B</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t \t \t \t
\t \t \t \t \t <response_lid ident="RESPONSE-c16a5320fa475530d9583c34fd356ef5" rcardinality="Multiple">
\t \t \t \t \t \t <material>
\t \t \t \t \t \t \t <mattext texttype="text/html">B</mattext>
\t \t \t \t \t \t </material>
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option0"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">A</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t \t <response_label ident="Option1"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">B</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t \t \t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE-34173cb38f07f89ddbebc2ac9128303f">Option0</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">5</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar> \t \t \t \t \t \t
\t \t \t \t \t \t <varequal respident="RESPONSE-c16a5320fa475530d9583c34fd356ef5">Option1</varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="Respondus_Correct">5</setvar>
\t \t \t \t </respcondition>
\t \t \t \t \t \t \t \t \t \t </resprocessing>
\t \t \t \t \t <itemfeedback ident="FEEDBACK">
\t \t \t \t <solution>
\t \t \t \t \t <solutionmaterial>
\t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t <mattext texttype="text/html">Optional Feedback</mattext>
\t \t \t \t \t \t \t </material>
\t \t \t \t \t \t </flow_mat>
\t \t \t \t \t </solutionmaterial>
\t \t \t \t </solution>
\t \t \t </itemfeedback>
\t \t \t \t </item>
<!-- true or false question (aka multiple choice with two choices) -->
\t \t <item title="True or False question" ident="ITEM_8">
\t \t \t <itemmetadata>
\t \t \t \t <qtimetadata>
\t \t \t \t \t <qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_itemtype</fieldlabel>
\t \t \t \t \t \t <fieldentry>Logical Identifier</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>qmd_questiontype</fieldlabel>
\t \t \t \t \t \t <fieldentry>True/false</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>cc_profile</fieldlabel>
\t \t \t \t \t \t <fieldentry>cc.true_false.v0p1</fieldentry>
\t \t \t \t \t </qtimetadatafield>
<qtimetadatafield>
\t \t \t \t \t \t <fieldlabel>cc_weighting</fieldlabel>
\t \t \t \t \t \t <fieldentry>5</fieldentry>
\t \t \t \t \t </qtimetadatafield>
\t \t \t \t </qtimetadata>
\t \t \t </itemmetadata>
\t \t \t <presentation>
\t \t \t \t <flow>
\t \t \t \t \t <material>
\t \t \t \t \t \t <mattext texttype="text/html">true</mattext>
\t \t \t \t \t </material>
\t \t \t \t \t <response_lid ident="RESPONSE8" rcardinality="Single">
\t \t \t \t \t \t <render_choice shuffle="No">
\t \t \t \t \t \t \t <response_label ident="ChoiceT"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">True</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t \t <response_label ident="ChoiceF"> \t
\t \t \t \t \t \t \t \t <flow_mat>
\t \t \t \t \t \t \t \t \t <material>
\t \t \t \t \t \t \t \t \t \t <mattext texttype="text/html">False</mattext>
\t \t \t \t \t \t \t \t \t </material>
\t \t \t \t \t \t \t \t </flow_mat>
\t \t \t \t \t \t \t </response_label>
\t \t \t \t \t \t </render_choice>
\t \t \t \t \t </response_lid>
\t \t \t \t </flow>
\t \t \t </presentation>
\t \t \t <resprocessing>
\t \t \t \t <outcomes>
\t \t \t \t \t <decvar varname="SCORE" />
\t \t \t \t </outcomes>
\t \t \t \t <respcondition title="CorrectResponse">
\t \t \t \t \t <conditionvar>
\t \t \t \t \t \t <varequal respident="RESPONSE8">
\t \t \t \t \t \t \t ChoiceT \t \t \t \t \t \t </varequal>
\t \t \t \t \t </conditionvar>
\t \t \t \t \t <setvar varname="que_score" action="Set">5</setvar>
\t \t \t \t </respcondition>
\t \t \t </resprocessing>
\t \t \t \t </item> \t \t </section>
\t </assessment>
</questestinterop>
答
此问题是由导致,变量用于保存数组的以空字符串启动。
PHP7有一个非常严格的变量类型验证。在PHP7之前,当一个变量在代码中被视为与它初始化的类型不同的类型时,PHP会默认将其转换为新类型。使用PHP7时,该变量在整个代码中被视为初始化类型,在这种情况下,结果是指定为0的数组值将被截断以仅从每个数组值中取第一个字符来组成字符串。