PHP第七课:变量声明、变量赋值
变量声明、变量赋值
php
<?php header("content-type:text/html;charset=utf-8"); //变量:存储 各种数据的一个容器 //变量命名规则 //$ //$字母数字下划线 $age = 18; $name = "程益利"; $sex = "男"; $weight = 130; $height = 185; echo "我叫" . $name . ",年龄:" . $age . ",性别:" . $sex . ",体重:" . $weight . ",身高:" .$height; ?>
php
<?php $w_name = "菜徐坤的篮球网站"; $my_pic1 = "cxk.jpg"; ?>
html
<!doctype html> <html> <head> <meta charset="UTF-8"> <title><?php echo $w_name; ?></title> </head> <body> <h1>菜徐坤打篮球 </h1> <h2> <img src="<?php echo $my_pic1; ?>" alt=""> </h2> </body> </html>
php
<?php header("content-type:text/html;charset=utf-8"); $m1 = "01.张碧晨 - 凉凉.mp3"; $m2 = "广东爱情故事_广东雨神.mp3"; ?>
html
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <audio src="<?php echo $m1; ?>" controls="controls"></audio> <br><br> <audio src="<?php echo $m2; ?>" controls="controls"></audio> </body> </html>
php
<?php header("content-type:text/html;charset=utf-8"); //数组:一组数据的集合 $mlist = array("马云","马化腾","李开复","刘强东"); echo "<pre>"; //打印输出 print_r($mlist); echo "</pre>"; ?>
还没有留言,还不快点抢沙发?