this
this关键字为指向当前对象的指针,可以用该关键字调用当前类体中的属性和方法。
<?php
class work {
private $x;
private $y;
function _construct($a,$b){ //通过this关键字对当前类体中的属性进行赋值
$this->x=$a;
$this->y=$b;
}
}
?>
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器
this关键字为指向当前对象的指针,可以用该关键字调用当前类体中的属性和方法。
<?php
class work {
private $x;
private $y;
function _construct($a,$b){ //通过this关键字对当前类体中的属性进行赋值
$this->x=$a;
$this->y=$b;
}
}
?>