Rumah >pembangunan bahagian belakang >tutorial php >判断指 指定值输出!该如何解决
判断指 指定值输出!
<?php<br />$n=$_GET['che'];<br />define("A", $n);<br />if(A==star){echo '1';}<br />else if(A==movie){echo '9';}<br />else if(A==tv){echo '10';}<br />else if(A==yue){echo '10';}<br />else if(A==zongyi){echo '12';}<br />else if(A==news){echo '15';}<br />else if(A==yanchu){echo '13';}<br />else if(A==fashion){echo '20';}<br />else if(A==astro){echo '23';}<br /><br />在这里弄个 统一的值输出<br />$b 这样 echo 里的值全弄到$b去 用B输出<br />?>
$dict = array(<br /> 'star' => '1',<br /> 'movie' => '9',<br /> 'tv' => '10',<br /> 'yue' => '10',<br /> 'zongyi' => '12',<br /> 'news' => '15',<br /> 'yanchu' => '13',<br /> 'fashion' => '20',<br /> 'astro' => '23',<br />);<br />echo isset($dict[$_GET['che']]) ? $dict[$_GET['che']] : ''