Username/Email
Password
login
Remember Me
Trouble logging in?
header
Solutions to your goals...
sign in
my journal
members admin +
my account
target accounts
tech view
social view
community +
friends
following
day plan
share
create
store
manage
track
Title: PHP魔法函数及变量
Username:
Required field cannot be left blank.
User name already exists, please choose another one.
First Name:
Required field cannot be left blank.
Last Name:
Required field cannot be left blank.
Password:
Required field cannot be left blank.
Not less than 6 characters
Re-type Password:
The two passwords are not consistent.
Email:
Required field cannot be left blank.
Email format is invalid.
Another user has already registered with that email address.
Re-type Email:
The two emails are not consistent.
create free account
add to my library
add to my day plan
share
Goal: this task will improve the successfulness on the goal to Learning PHP Magic Methods and Constants
Dashu Huang published this Operative Task at isodoit.com under Education | Engineering and Cuisine | Brunch | European Cuisine | Northern European Cuisine | Cuisines of the British Isles | British Cuisine | Anglo-Indian cuisine
Doers: 4 | Form: Operative Task | Phase: Conclusion | Type: Pre-Event | Level: 3 | Code:
Start: Jul 23, 2019 | When: Day 1 | Duration: 10 Minute(s)
Steps:
  • __construct() 实例化时被调用

    在实例化的时候此函数将被调用,即使在类中还存在另外一个函数其函数名和类名一致的情况下。仍将调用此函数,而另外一个函数将不被调用。

    注意:在缺省情况下,当创建子类的对象时如果要调用父类的构造函数必须使用如下语句
    parent::__construct();
    response:
  • __destruct() 析构函数

    当删除一个对象或对象操作终止时被调用。
    response:
  • __call() 对象调用某个函数,如果函数存在,则直接调用否则会调用此函数。
    response:
  • __get() 当对象读取一个属性时,如果属性存在并且此属性可见,则直接返回属性值,否则会调用此函数。
    response:
  • __set() 当对象设置一个属性的值时,如果此属性存在并且可见则直接给此属性赋值,否则将调用此函数。
    response:
  • __toString() 当打印一个对象时,将会调用此函数。
    response:
  • __clone() 用来克隆一个对象。
    $obj1 = new MyClass();
    $obj2 = clone $obj1;
    response:
  • __sleep() 系列化对象之前被调用。
    response:
  • __wakeup() unserialize时被调用,用来初始化对象
    response:
  • __isset() 用来判断一个对象的属性是否存在 isset($obj->attr)
    response:
  • __unset() 用来unset对象的属性。
    response:
  • __set_state()
    当使用 var_export() 来输出对象时将会调用此函数。
    response:
  • __invoke()

    当尝试以调用一个函数的方式调用对象时将会调用此函数。
    <?php
    class CallableClass
    {
    function __invoke($x) {
    var_dump($x);
    }
    }
    $obj = new CallableClass;
    $obj(5); // 此时将会调用 __invoke() 函数
    ?>
    response:
  • __LINE__ 返回文件中的当前行号
    response:
  • __FILE__ 返回当前文件的完整路径及文件名。如果此文件被包含在另外一个文件当中,这返回包含其的文件的路径及文件名。
    __DIR__ 返回当前文件所处的文件夹路径。
    response:
  • __CLASS__ 返回当前类名。
    __FUNCTION__ 返回当前函数名称。 PHP5版本以上区别大小写
    __METHOD__ 返回当前类名及当前函数名。
    类名::函数名
    response:
save and continue
messages (0)
description
past results
(No Message)
© 2019 Furious Integrated Training Systems, Inc. All rights reserved.