真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

php程序設(shè)計經(jīng)典300例,第36-38例

第36例:

使用分支語句加載不同網(wǎng)頁主體



      



     $shop_id=$_GET['id'];
     switch($shop_id)
        {
            case "shop1"://如果ID為shop1
                 require("shop1.php");
                 break;
            case "shop2":
                 require("shop2.php");
                 break;
            case "shop3":
                 require("shop3.php");
                 break;
            default://默認(rèn)的選擇
                 require("shop1.php");
                 
        }
?>

第37例:

php萬年歷

header("Content-type:text/html;charset=utf-8");
date_default_timezone_set("Asia/Shanghai");//設(shè)置日期時區(qū)為中國時區(qū)
$today = time();
$year =@$_GET["year"];
$month = @$_GET["month"];
if($year=='') $year = date("Y",$today);
if($month=='') $month = date("m",$today);
if((int)$month==0){$year-=1;$month=12;}
$time = mktime(0,0,0,$month,1,$year);//格式化當(dāng)前日期
$year = date('Y',$time);
$month = date('m',$time);
$days = date('t',$time);//當(dāng)前月份一共有幾天
$fstdw = date('N',$time);//當(dāng)前月份第一天為星期幾
echo "";
echo "";
echo"";
$str   = "";
$str .= "";
$str .= "";
$str .= "";
$str .= "";
$str .= "";
$str .= "";
echo $str;
echo "";
$rows = ceil(($days + $fstdw-1)/7);
$cd = 1;
for($i=0;$i<$rows;$i++){
echo "";
    for($j=0;$j<7;$j++){
     echo "";
    }
echo "";
}
echo "
";
$str   = "";
$str .= "
".$year."年 ";
$str .= "";
$str .= "
   ";
$str .= "";
$str .= "
".$month."月 ";
$str .= "";
$str .= "
";
echo $str;
echo "
";
     if($cd >= $fstdw && $cd<$days+$fstdw){
     $oday = $cd-$fstdw+1;
     if($oday == date('d',time())){
     echo "";
     }
     echo $oday;
     }else{
     echo ".";
     } 
     $cd++;
     echo "
";
?>


第38例:
index.php頁面:


header("Content-Type:text/html;charset=utf-8");
MySQL_connect("localhost","root","123456") or die("數(shù)據(jù)庫連接有誤!");
mysql_select_db("student") or die("數(shù)據(jù)庫選擇有誤!");
mysql_query("set names 'utf8'");
?>
 
    
        
        用戶管理
        
    
    
        
        

        

            
                
                    
                    
                    
                    
                    
                
                                    //定義分頁所需要的變量
                    $page=isset($_GET['page'])?$_GET['page']:1;//當(dāng)前頁
                    $pagesize=5; //每頁顯示的條數(shù)
                    //獲取總條數(shù)數(shù)據(jù)
                    $sql="select count(*) from student";
                    $result=mysql_query($sql);
                    $maxrows=mysql_result($result,0,0);
                    $maxpage=ceil($maxrows/$pagesize);
                    //到達(dá)最后一頁判斷
                    if($page>$maxpage){
                    $page=$maxpage;
                    }
                    //到達(dá)第一頁判斷
                    if($page<1){
                        $page=1;
                    }
                    $offset=($page-1)*$pagesize;
                    $sql="select * from student limit {$offset},$pagesize";
                    $result=mysql_query($sql);
                    while($rows=mysql_fetch_assoc($result)){
                        echo "";
                        echo "";
                        echo "";
                        echo "";
                        echo "";
                        echo "";
                        echo "";
                    }
                ?>            
            
編號用戶名郵件地址注冊日期選擇
{$rows['member_id']}{$rows['username']}{$rows['email']}".date("Y-m-d H:i:s",$rows['registertime']+8*3600)."

            
            

                

                                echo "當(dāng)前{$page}/{$maxpage}頁 共計{$maxrows}條信息    ";
                echo "首頁    ";
                echo "上一頁    ";
                echo "下一頁    ";
                echo "最后一頁";
                echo " ";
                ?>
                

        

        

    



check.php頁面:

PRINT("
");
print_r($_POST);
exit();
header("Content-Type:text/html;charset=utf-8");
mysql_connect("localhost","root","123456") or die("數(shù)據(jù)庫連接有誤!");
mysql_select_db("student") or die("數(shù)據(jù)庫選擇有誤!");
mysql_query("set names 'utf8'");

if(!empty($_POST['member_id'])){
$arr=$_POST['member_id'];
$str_key="";
foreach($arr as $key=>$value){
$sql="delete from student where member_id =".$value;
mysql_query($sql);
$str_key.=$value.",";
}
$new_str=substr($str_key,0,strlen($str_key)-1);
echo"";
}
?>

創(chuàng)新互聯(lián)服務(wù)項目包括麟游網(wǎng)站建設(shè)、麟游網(wǎng)站制作、麟游網(wǎng)頁制作以及麟游網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,麟游網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到麟游省份的部分城市,未來相信會繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!


本文標(biāo)題:php程序設(shè)計經(jīng)典300例,第36-38例
標(biāo)題來源:http://weahome.cn/article/gojhcg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部