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. mysql 数据查询全讲

    数据查询 涉及到DQL(Data Query Language)是sql语句的一类 本文全面介绍了mysql下 select 语句的各种查询方式:普通查询,模糊查询,查询排序,分页查询,聚合函数查询  ...

  2. python sort、sorted高级排序技巧

    文章转载自:脚本之家 Python list内置sort()方法用来排序,也可以用python内置的全局sorted()方法来对可迭代的序列排序生成新的序列. 1)排序基础 简单的升序排序是非常容易的 ...

  3. [LeetCode&Python] Problem 661. Image Smoother

    Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother t ...

  4. 常用cursor光标说明

    1.cursor语法: cursor : auto | crosshair | default | hand | move | help | wait | text | w-resize |s-res ...

  5. Codeforces Round #544 (Div. 3) (补)

    D:没有注意到a==0&&b==0的情况,把自己卡崩了.对于数学公式推导一定要注意关于0的特殊情况,不可以少 #include <iostream> #include &l ...

  6. FZU软工第六次作业-团队选题报告

    作业链接 队长博客:陈晓彬 团队选题报告 选题报告PPT 原型展示 前言 经过团队的讨论,我们对自己的选题进行了项目立意的进一步确定,后面有项目来源.同时,我们将自己的APP的名字改成了"一 ...

  7. lamp 相关

    1.LAMP = linux + apache + mysql(mariadb/mongodb) + php 2.mysql 安装:先下载安装包: wget -c http://mirrors.soh ...

  8. Linux压缩文件笔记

    https://my.oschina.net/dongqianlin/blog/97168http://linux.it.net.cn/CentOS/fast/2017/0628/27029.html ...

  9. Go Example--递归

    package main import "fmt" func main() { fmt.Println(fact(7)) } //函数的递归 func fact(n int) in ...

  10. 基于lfslivecd-x86-6.3-r2145安装vnc和qemu

    文章目录 把lfslivecd复制到硬盘上使用 编译安装vnc 前后下载了多个软件包进行编译安装 编译VNC 启动VNC 编译安装qemu 启动VNC客户端并连接虚拟机的vncviewer 把lfsl ...