下载此文档

PHP培训课件★review.ppt


文档分类:IT计算机 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11 下载此文档
文档列表 文档介绍
期末复习
关于类的问题(1)
例:
<?
class test{
var $a,$b;
function test($a,$b){
$this->a=$a;
$this->b=$b;
}
关于类的问题(2)
function getA(){
return $this->a;
}
function getB(){
return $this->b;
}
function xprint(){
echo "a=".$this->a." b=".$this->b;
}
};
关于类的问题(3)
class test1 extends test{
var $c,$d;
function test1($a,$b,$c,$d){
$this->a=$a;
$this->b=$b;
$this->c=$c;
$this->d=$d;
}
关于类的问题(4)
function getC(){
return $this->c;
}
function getD(){
return $this->d;
}
关于类的问题(5)
function xprint(){
echo "a=".$this->a." b=".$this->b." c=".$this->c." d=".$this->d;
}
};
$x=new test(0,0);
$x->xprint();
关于类的问题(6)
echo "<br>\n";
$y=new test1(1,2,3,4);
$y->xprint();
?>
运行结果:
a=0 b=0 a=1 b=2 c=3 d=4
上例说明:类具有多态性和单继承性。
在PHP中类不能多继承,类中函数也不能重载。
试题示例(1)
选择题:
:
(A)chdir (B)cd (C) opendir (D)rmdir
2. PHP中用来删除当前目录的函数是:
(A)chdir (B)cd (C) opendir (D)rmdir
试题示例(2)
填空题
。请填空【1】。 <? $myFile = 【1】; if(!($myFile)) { echo "file could not be opened"; exit; }
试题示例(3)
for($index=0; $index<10; $index++) { fputs($myFile, "line $index\n"); } fclose($myFile); ?> 【1】答案:

PHP培训课件★review 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数11
  • 收藏数0 收藏
  • 顶次数0
  • 上传人文库旗舰店
  • 文件大小75 KB
  • 时间2018-05-09