PHP类与对象函数

PHP类与对象函数

ID:39467256

大小:133.50 KB

页数:13页

时间:2019-07-04

PHP类与对象函数_第1页
PHP类与对象函数_第2页
PHP类与对象函数_第3页
PHP类与对象函数_第4页
PHP类与对象函数_第5页
资源描述:

《PHP类与对象函数》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、class_alias--为一个类创建别名bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ])基于用户定义的类 original 创建别名 alias。这个别名类和原有的类完全相同。成功时返回 TRUE,或者在失败时返回 FALSE。

2、on__construct($username,$age,$height,$weight){$this->username=$username;$this->age=$age;$this->height=$height;$this->weight=$weight;}publicfunction__set($name,$value){$this->$name=$value;}publicfunction__get($name){return$this->$name;}publicfunction__toS

3、tring(){return'';}}class_alias('Person','Pepole');$p_person=newPerson('zhaofei',23,185,72);var_dump($p_person);$p_pepole=newPepole('xiaoming',27,175,62);var_dump($p_pepole);//theobjectsarethesamevar_dump($p_person==$p_pepole,$p_person===$p_pepole);var_du

4、mp($p_personinstanceof$p_pepole);//theclassesarethesamevar_dump($p_personinstanceofPerson);var_dump($p_personinstanceofPepole);var_dump($p_pepoleinstanceofPerson);var_dump($p_pepoleinstanceofPepole);?>class_exists — 检查类是否已定义bool class_exists ( string $cl

5、ass_name [, bool $autoload =true ])检查指定的类是否已定义。username=$username;$this->age=$age;$this->height=$height;$this->weight

6、=$weight;}publicfunction__set($name,$value){$this->$name=$value;}publicfunction__get($name){return$this->$name;}publicfunction__toString(){return'';}}function__autoload($class){include($class.'.php');if(!class_exists($class)){trigger_error("Unabletoloadc

7、lass:$class",E_USER_WARNING);}}if(class_exists('Person')){$p_person=newPerson('zhaofei',23,185,72);var_dump($p_person);}?>get_called_class--后期静态绑定("LateStaticBinding")类的名称string get_called_class ( void )获取静态方法调用的类名。返回类的名称,如果不是在类中调用则返回 FALSE。

8、son{public$username;public$age;public$height;public$weight;staticpublic$number=0;publicfunction__construct($username,$age,$height,$weight){$this->username=$username;$this->age=$age;$this->height=$height;$this->weight=$weig

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。