您的位置:首页 > 产品设计 > UI/UE

PHP自学笔记 ---李炎恢老师PHP第一季 TestGuest0.5

2016-12-27 20:56 288 查看
1、define('SCRIPT','index');
//定义一个常量,以引用各个页面的单独css文件

如index.php页面调用时,href="style/1/  <?php echo SCRIPT; ?> .css",用的是index.css文件.

   register.php页面调用时,href="style/1/  <?php echo SCRIPT; ?> .css",用的是register.css文件.

2、

展示头像的for循环:
<dl>
<?php for($i=1;$i<10;$i++){?><dd><img src="face/m0<?php echo $i?>.gif" alt="头像" /></dd> <?php }?>
</dl>
展示头像的foreach循环:

<dl>
<?php foreach(range(1,9) as $num){?><dd><img src="face/m0<?php echo $num?>.gif" alt="头像<?php echo $num?>" /></dd>
<?php }?></dl>
<dl>

细节:echo range(1,9);    错误,Notice: Array to string conversion in I:\wamp\www\TestGuest0.5\face.php on line 13 Call Stack

Notice: Array to string conversion in I:\wamp\www\TestGuest0.5\face.php on line
13
Call Stack
print_r (range(1,9));正确,输出:Array( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9)

foreach(range(1,9) as $number){

  echo $number;

 }//输出:123456789

3、//等待网页加载完毕再执行

window.onload=function(){
var faceimg=document.getElementById('faceimg');
faceimg.onclick=function(){
window.open('face.php','face','width=501,height=400,top=100,left=10,scrollbars=1');
}
};
onclick 打成onclik······找了一个多小时找不到···我也是醉了·~~~~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐