日期:2014-05-19  浏览次数:20894 次

将这段PHP换成C#语言.
header( "Content-type:   text/vnd.wap.wml ");
echo( " <?xml   version=\ "1.0\ "?> \n ");
echo( " <!DOCTYPE   wml   PUBLIC   \ "-//WAPFORUM//DTD   WML   1.1//EN\ "
\ "http://www.wapforum.org/DTD/wml_1.1.xml\ "> \n\n ");
echo( " <!--The   application   PizzaCalc   was   originally   made   by   The   Crusaders
www.crusaders.no   on   the   Commodore   Amiga   --> \n ");
echo( " <!--   It   was   unfortunately   not   possible   to   emulate   the   crap   interger   handling   of   the
original   program   --> \n ");
?>
<wml>
<?
    if($action   ==   "calc ")   {
      echo( " <card   id=\ "result\ "   title=\ "PizzaCalc\ "> \n ");
      echo( " <do   type=\ "prev\ "   label=\ "Back\ "> \n ");
      echo( " <go   href=\ "pizzacalc.html#input\ "/> \n ");
      echo( " </do> \n ");
      echo( " <p> \n ");
      echo( "The   cost   per   eater   will   be   ".$total   /   $eaters. " <br/> \n ");
    }
    else   {
      echo( " <card   id=\ "input\ "   title=\ "PizzaCalc\ "> \n ");
      echo( " <p> \n ");
echo( " <anchor> Split   Pizza   bill
<go   href=\ "pizzacalc.html?total=\$(total)&eaters=\$(eaters)&action=calc\ "/>
</anchor> \n ");
      echo( " <br/> \n ");
      echo( "Total   cost:   <input   type=\ "text\ "   name=\ "total\ "   format=\ "*N\ "/> \n ");
      echo( "Eaters:   <input   type=\ "text\ "   name=\ "eaters\ "   format=\ "*N\ "/> \n ");
    }
?>
</p>
</card>
</wml>
这是一段输出WML页面的PHP语言.如何将他转换成C#语言.
我知道用Response,然后设置类型.这里不明白的一段语句是:  
if($action   ==   "calc ")
在C#里我得不到这个$action


------解决方案--------------------
不懂PHP,会不会是Request.QueryString[ "action "]?
瞎猜的。
------解决方案--------------------
if($action == "calc ")
是一个传入的操作类型
比如
http://www.libing.net.cn?action=calc
然后获得了$action
其实就是楼上的猜测的
Request.QueryString[ "action "]

一般PHP是
$_GET[ 'action '] == "calc "