php代码
<?php @header('Content-Type: text/html; charset=utf-8'); if ( $_GET['startStation'] && $_GET['arriveStation'] && $_GET['date']) { require 'chepiao100.php'; $cp = new chepiao100(); $data = $cp->getData('yupiao', $_GET); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css.css?1.1.6"/> <title>火车余票查询</title> </head> <body> <form id="get" name="get" action="" method="get"> <?php require 'header.php';?> <p>发站:<input name="startStation" type="text" id="startStation" value="<?php echo $_GET['startStation'] ? $_GET['startStation']: '上海'; ?>"/></p> <p>到站:<input name="arriveStation" type="text" id="arriveStation" value="<?php echo $_GET['arriveStation'] ? $_GET['arriveStation']: '北京'; ?>"/></p> <p>日期:<input name="date" type="text" id="date" value="<?php echo $_GET['date'] ? $_GET['date']: date('Y-m-d', strtotime('+ 1 day'))?>"/></p> <BR /> <p><input type="submit" value=" 提交查询 " class="button"/></p> </p> </p> </form> <BR /> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr class="head"> <td> </td> <td>车次</td> <td>类型</td> <td>发站</td> <td>到站</td> <td>发时</td> <td>到时</td> <td>运行时间</td> <td>天数</td> <td>价格</td> <td>余票</td> <td> </td> </tr> <?php if (count($data) > 0) :?> <?php foreach($data as $val): ?> <tr class="item"> <td> </td> <td><?php echo $val['trainCode']; ?></td> <td><?php echo $val['trainGrade']; ?></td> <td><?php echo str_replace(array('shi','guo','zhong'), array('[始]','[过]','[终]'), $val['startType']).$val['startStation']; ?></td> <td><?php echo str_replace(array('shi','guo','zhong'), array('[始]','[过]','[终]'), $val['arriveType']).$val['arriveStation']; ?></td> <td><?php echo $val['startTime']; ?></td> <td><?php echo $val['endTime']; ?></td> <td><?php echo $val['takeTime']; ?></td> <td><?php echo $val['day_diff']; ?></td> <td> <?php if($val['business']!='--'): ?> <p>商务座: <?php echo $val['business-prc']; ?></p> <?php endif; ?> <?php if($val['best-seat']!='--'): ?> <p>特等座:<?php echo $val['best-seat-prc']; ?></p> <?php endif; ?> <?php if($val['one-seat']!='--'): ?> <p>一等座:<?php echo $val['one-seat-prc']; ?></p> <?php endif; ?> <?php if($val['two-seat']!='--'): ?> <p>二等座:<?php echo $val['two-seat-prc']; ?></p> <?php endif; ?> <?php if($val['vag-sleeper']!='--'): ?> <p>高级软卧:<?php echo $val['vag-sleeper-prc']; ?></p> <?php endif; ?> <?php if($val['soft-sleeper']!='--'): ?> <p>软 卧:<?php echo $val['soft-sleeper-prc']; ?></p> <?php endif; ?> <?php if($val['hard-sleeper']!='--'): ?> <p>硬 卧:<?php echo $val['hard-sleeper-prc']; ?></p> <?php endif; ?> <?php if($val['soft-seat']!='--'): ?> <p>软 座:<?php echo $val['soft-seat-prc']; ?></p> <?php endif; ?> <?php if($val['hard-seat']!='--'): ?> <p>硬 座:<?php echo $val['hard-seat-prc']; ?></p> <?php endif; ?> <?php if($val['none-seat']!='--'): ?> <p>无 座:<?php echo $val['two-seat-prc'] ? $val['two-seat-prc'] : $val['hard-seat-prc']; ?></p> <?php endif; ?> </td> <td> <?php if($val['business']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['business']; ?>张</p> <?php endif; ?> <?php if($val['best-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['best-seat']; ?>张</p> <?php endif; ?> <?php if($val['one-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['one-seat']; ?>张</p> <?php endif; ?> <?php if($val['two-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['two-seat']; ?>张</p> <?php endif; ?> <?php if($val['vag-sleeper']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['vag-sleeper']; ?>张</p> <?php endif; ?> <?php if($val['soft-sleeper']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['soft-sleeper']; ?>张</p> <?php endif; ?> <?php if($val['hard-sleeper']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['hard-sleeper']; ?>张</p> <?php endif; ?> <?php if($val['soft-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['soft-seat']; ?>张</p> <?php endif; ?> <?php if($val['hard-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['hard-seat']; ?>张</p> <?php endif; ?> <?php if($val['none-seat']!='--'): ?> <p class="org"><i class="bg yu"></i><?php echo $val['none-seat']; ?>张</p> <?php endif; ?> </td> <td> </td> </tr> <?php endforeach; ?> <?php endif; ?> </table> </body> </html>