您的位置:首页 > 编程语言 > PHP开发

一天一篇之php学习篇1

2014-01-10 17:01 239 查看
一 html表单及框体结构

以下列出比较少用的html元素,

1:<blockquote></blockquote>加入浏览器会按两边缩进的方式显示出来。

2:<font></font>用该属性来,调整输出文字的样式大小,提供size、color属性,测试代码:

<font size="+1" color="red">红色的文字</font>
<!--在默认的文字的基础上,尺寸加了一号,最大为+6-->


3:<frameset></frameset>,<frame/>,<noframe></noframe>用法如下:

<frameset cols="25%,*"><!-- frameset放在body的外面,具有两个属性,col列定位,row行定位,这两个属性取值可以是'%''px''*',*代表那些未被说明的空间 -->
<frame src="menu.html" scrolling="no" name="left" />
<frame src="page1.html" name="Main"  scrolling="auto" />
<noframes>
<body>
<p>对不起,你的浏览器不支持框架!</p>
</body>
</noframes>
</frameset>


page1.html

<body>
<p><font color="#ff0000" size="+6">这是第一页!!!</font></p>
</body>


page2.html

<body>
<p><font color="#ff0000" size="+6">这是第二页!!!</font></p>
</body>


menu.html

<body>
<p><font color="#ff0000">目录</font></p>
<p><a href="page1.html" target="Main">链接到第一页</a></p>
<p><a href="page2.html" target="Main">链接到第二页</a></p>
</body>


4 <form></form>有三个属性action method target mehod有两个值GET POST GET处理程序从当前HTML获取数据,POST是当前HMTL把数据传递给HTML。

5 <select></select>option selected为默认值

6 php全局变量 global和$GLOBALS

<?php
function add()
{
$GLOBALS["A"] = $GLOBALS["B"]   + $GLOBALS["C"] ;
return $GLOBALS["A"] ;
}
$A = 1;
$B = 2;
$C = 3;
add();
echo $A; //5
?>


7 php连接字符串 . "{a}{b}" .=

<?php
$str = "a";
$str .= "b";
echo $str;//ab
$str1 = "c";
$str2 = "{$str}{$str1}";
echo $str2;//abc
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: