Rumah > php教程 > PHP源码 > 12306火车票API接口QQ 89914505

12306火车票API接口QQ 89914505

PHP中文网
Lepaskan: 2016-05-23 16:41:12
asal
1986 orang telah melayarinya

php代码

<?php 
@header(&#39;Content-Type: text/html; charset=utf-8&#39;);
if ( $_GET[&#39;startStation&#39;] && $_GET[&#39;arriveStation&#39;] && $_GET[&#39;date&#39;])
{
	require &#39;chepiao100.php&#39;;
	$cp = new chepiao100();
	$data = $cp->getData(&#39;yupiao&#39;, $_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 &#39;header.php&#39;;?>
<p>发站:<input name="startStation" type="text" id="startStation" value="<?php echo $_GET[&#39;startStation&#39;] ? $_GET[&#39;startStation&#39;]: &#39;上海&#39;; ?>"/></p>
<p>到站:<input name="arriveStation" type="text" id="arriveStation" value="<?php echo $_GET[&#39;arriveStation&#39;] ? $_GET[&#39;arriveStation&#39;]: &#39;北京&#39;; ?>"/></p>
<p>日期:<input name="date" type="text" id="date" value="<?php echo $_GET[&#39;date&#39;] ? $_GET[&#39;date&#39;]: date(&#39;Y-m-d&#39;, strtotime(&#39;+ 1 day&#39;))?>"/></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[&#39;trainCode&#39;]; ?></td>
		<td><?php echo $val[&#39;trainGrade&#39;]; ?></td>
		<td><?php echo str_replace(array(&#39;shi&#39;,&#39;guo&#39;,&#39;zhong&#39;), array(&#39;[始]&#39;,&#39;[过]&#39;,&#39;[终]&#39;), $val[&#39;startType&#39;]).$val[&#39;startStation&#39;]; ?></td>
		<td><?php echo str_replace(array(&#39;shi&#39;,&#39;guo&#39;,&#39;zhong&#39;), array(&#39;[始]&#39;,&#39;[过]&#39;,&#39;[终]&#39;), $val[&#39;arriveType&#39;]).$val[&#39;arriveStation&#39;]; ?></td>
		<td><?php echo $val[&#39;startTime&#39;]; ?></td>
		<td><?php echo $val[&#39;endTime&#39;]; ?></td>
		<td><?php echo $val[&#39;takeTime&#39;]; ?></td>
		<td><?php echo $val[&#39;day_diff&#39;]; ?></td>
		<td>
		<?php if($val[&#39;business&#39;]!=&#39;--&#39;): ?>
			<p>商务座: <?php echo $val[&#39;business-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;best-seat&#39;]!=&#39;--&#39;): ?>
			  <p>特等座:<?php echo $val[&#39;best-seat-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;one-seat&#39;]!=&#39;--&#39;): ?>
			  <p>一等座:<?php echo $val[&#39;one-seat-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;two-seat&#39;]!=&#39;--&#39;): ?>
			  <p>二等座:<?php echo $val[&#39;two-seat-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;vag-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p>高级软卧:<?php echo $val[&#39;vag-sleeper-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;soft-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p>软 卧:<?php echo $val[&#39;soft-sleeper-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;hard-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p>硬 卧:<?php echo $val[&#39;hard-sleeper-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;soft-seat&#39;]!=&#39;--&#39;): ?>
			  <p>软 座:<?php echo $val[&#39;soft-seat-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;hard-seat&#39;]!=&#39;--&#39;): ?>
			  <p>硬 座:<?php echo $val[&#39;hard-seat-prc&#39;]; ?></p>
			<?php endif; ?>
			<?php if($val[&#39;none-seat&#39;]!=&#39;--&#39;): ?>
			  <p>无 座:<?php echo $val[&#39;two-seat-prc&#39;] ? $val[&#39;two-seat-prc&#39;] : $val[&#39;hard-seat-prc&#39;]; ?></p>
			<?php endif; ?>
		 </td>
		<td>
			<?php if($val[&#39;business&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;business&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;best-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;best-seat&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;one-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;one-seat&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;two-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;two-seat&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;vag-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;vag-sleeper&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;soft-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;soft-sleeper&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;hard-sleeper&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;hard-sleeper&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;soft-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;soft-seat&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;hard-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;hard-seat&#39;]; ?>张</p>
			<?php endif; ?>
			<?php if($val[&#39;none-seat&#39;]!=&#39;--&#39;): ?>
			  <p class="org"><i class="bg yu"></i><?php echo $val[&#39;none-seat&#39;]; ?>张</p>
			<?php endif; ?>
	</td>
	<td> </td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>

</body>
</html>
Salin selepas log masuk
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel terbaru oleh pengarang
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan