this就是指向当前对象实例的指针,不指向任何其他对象或类

如$this->fun1();

self:指向类本身,也就是self是不指向任何已经实例化的对象 ,self使用来指向类中的静态属性或者方法

self::$staticProperty

self::staticMothed;

parent: 指向父类的指针,一般我们使用parent来调用父类的构造函数或父类中的静态属性或静态方法

self与parent要结合::(域运算符号)

parent::$staticProperty

parent::Mothed;

--------注意$出现的位置,与this不同

$this绑定---这一点与C#不同

当一个对象调用一个它对应类的方法时,该方法执行之前先完成一个绑定,即是用

$this绑定到调用此方法的对象

即类的成员函数访问类中的属性或调用其他成员函数时,必须在前面加$this->

(这样才能在方法内对这个对象的属性进行操纵),如果没加的话,理解为方法内部的一个局部变量

php中的this,self,parent的更多相关文章

  1. android中出现Error retrieving parent for item: No resource found that matches the Theme.AppCompat.Light

    styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下错 ...

  2. Spring中 bean定义的parent属性机制的实现分析

    在XML中配置bean元素的时候,我们常常要用到parent属性,这个用起来很方便就可以让一个bean获得parent的所有属性 在spring中,这种机制是如何实现的?     对于这种情况 tra ...

  3. PHP面向对象中 static:: 与 self:: parent:: $this-> 的区别

    很多好几年工作经验的PHP工程师,对PHP面向对象中 static:: .self::.parent::.$this->  的定义和使用都不清晰,特做详细梳理: static:: 可以访问全局作 ...

  4. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  5. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别(跳出iframe方法)

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  6. 关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法

    关于js中"window.location.href"."location.href"."parent.location.href".&qu ...

  7. 关于js中window.location.href,location.href,parent.location.href,top.location.href用法

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  8. 关于VUE调用父实例($parent) 根实例 中的数据和方法

    this.$parent或者 this.$root 在子组件中判断this.$parent获取的实例是不是父组件的实例 在子组件中console.log(this.$parent)  在父组件中con ...

  9. spring中bean的配置详解--定义parent

    在工作中碰到了好多的配置文件,具体来说是spring 中bean配置的parent的配置,搞的我一头雾水,仔细看一下spring中有关bean的配置,剖析一下,具体什么含义! 一.Spring IoC ...

  10. maven项目pom.xml中parent标签的使用(转)

    原文地址:https://blog.csdn.net/qq_41254677/article/details/81011681 使用maven是为了更好的帮项目管理包依赖,maven的核心就是pom. ...

随机推荐

  1. 3D 网页,webgl ,threejs 实例

    http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/ http://adndevblog ...

  2. 【转】visualSFM生成的bundle.rd.out文件的格式

    1.bundle.out 文件包含了一些经过估算得到的场景和相机几何信息.文件的格式如下: //---------------------------------------------------- ...

  3. 本地存储之application cache和localstorage

    http://blog.csdn.net/kingliguo/article/details/52637087

  4. HPU组队赛B:问题(二进制枚举)

    时间限制1 Second 内存限制 512 Mb 题目描述 你有n个问题,你已经估计了第i个问题的难度为Ci,现在你想使用这些问题去构造一个问题集.比赛的问题集必须包含至少两个问题,而且比赛的总难度必 ...

  5. 《DSP using MATLAB》Problem 6.24

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  6. 在java中(==)的用法

  7. LeetCode – Number of Islands II

    A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand oper ...

  8. 【BZOJ4566】【HAOI2016】找相同字符

    后缀自动姬好,好写好调好ac 原题: 给定两个字符串,求出在两个字符串中各取出一个子串使得这两个子串相同的方案数.两个方案不同当且仅当这两 个子串中有一个位置不同. 1 <=n1, n2< ...

  9. idea新建工程项目结构

    一:新建项目 File--->new---->project--->Empt Project(空项目)--->next--->java_web--->Finish ...

  10. elasticsearch技术解析与实战(一) 入门和索引

    GET _cat/nodes GET _cat/health GET _cat/shards GET http://10.37.84.124:9200/secisland?pretty { " ...