我正在尝试一个听一个名字和两个等级的应用程序,做成绩的媒体然后将它保存在mysql数据库中。我无法让应用程序识别十进制等级(葡萄牙语)。这是我的实际代码:
<?xml version="1.0" encoding="utf-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="pt-BR">
<var name="media"/>
<form id="selecionar">
<field name="Selecao">
<prompt>
Voce gostaria de registrar ou consultar?
</prompt>
<grammar xml:lang="pt-BR" root="myrule">
<rule id="myrule">
<one-of>
<item> Registrar </item>
<item> Consultar </item>
</one-of>
</rule>
</grammar>
<filled>
<if cond="Selecao=='Registrar'">
<goto next="#nome"/>
<elseif cond="Selecao=='Consultar'" />
<prompt>
Você escolheu consultar.
</prompt>
</if>
</filled>
</field>
</form>
<form id="escolha">
<field name="escolhas">
<prompt>
Voce gostaria de fazer outra tarefa?
</prompt>
<grammar xml:lang="pt-BR" root="myrule2">
<rule id="myrule2">
<one-of>
<item> Sim </item>
<item> Nao </item>
</one-of>
</rule>
</grammar>
<filled>
<if cond="escolhas=='Sim'">
<goto next="#selecionar"/>
<elseif cond="escolhas=='Nao'" />
<prompt> Adeus. </prompt>
</if>
</filled>
</field>
</form>
<form id="nome">
<field name="nomealuno" grammar="pt-BR">
<prompt>
Qual o nome do aluno?
</prompt>
<grammar type="application/x-gsl">
<![CDATA[
NAME
[[alberto] {return("alberto ")}
[gabriele] {return("gabriele ")}
[luiz] {return("luiz ")}]
]]>
</grammar>
<filled namelist="nomealuno">
<prompt> O nome dito foi <value expr="nomealuno"/> </prompt>
<break strength="weak" time="1s" />
<goto next="#notaum"/>
</filled>
</field>
</form>
<form id="notaum">
<field name="notaum" slot="mySlot">
<prompt>
Qual a primeira nota?
</prompt>
<filled namelist="notaum" grammar="pt-BR" type="number">
<prompt> A nota dita foi <value expr="notaum"/> </prompt>
<goto next="#escolha"/>
</filled>
</field>
</form>
</vxml>
答案 0 :(得分:0)
您可以使用星号键(*)作为小数。
由于您使用的是内置语法:
<div class="text-1"><?php echo "Name: " . $teacher1 . "<br>" . "Department: " . $teacher1department . "<br>" . "Rating: " . $teacher1rating;?></div></br>
<div class="text-2"><br><?php echo "Name: " . $teacher2 . "<br>" . "Department: " . $teacher2department . "<br>" . "Rating: " . $teacher1rating;?></div></br>
<a href="?selected=2"><img src="icon.png" onclick="rating()" class="icon 2"></a><br>
<?php
function rating() {
/* Tells you who got the higher rating */
if($teacher1rating > $teacher2rating) {
$higherRating = $teacher1;
}
if($teacher1rating < $teacher2rating) {
$higherRating = $teacher2;
}
if (isset($_GET['selected'])) {
if($_GET['selected'] == $higherRating) {
header( 'Location: correct.php?teacher=' . $teacher1 );
}
if($_GET['selected'] != $higherRating) {
header( 'Location: incorrect.php?teacher=' . $teacher2);
}
}
?>
检查VXML 2.0 spec - Appendix P中的内置语法“号码”。