广告
返回顶部
首页 > 资讯 > 后端开发 > PHP编程 >php魔术方法有哪些及怎么使用
  • 786
分享到

php魔术方法有哪些及怎么使用

2023-07-04 23:07:55 786人浏览 独家记忆
摘要

这篇文章主要介绍“PHP魔术方法有哪些及怎么使用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“php魔术方法有哪些及怎么使用”文章能帮助大家解决问题。PHP中以双下划线“__”开始命名的内置方法被称

这篇文章主要介绍“PHP魔术方法有哪些及怎么使用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“php魔术方法有哪些及怎么使用”文章能帮助大家解决问题。

PHP中以双下划线“__”开始命名的内置方法被称作魔术方法,包括“__construct()”、“__set()”、“__get()”、“__isset()”、“__unset()”、“__sleep()”、“__wakeup()”、“__call()”、“__invoke()”等;其中“__construct()”是类的构造方法,是对象创建完成后第一个被对象自动调用的方法。

php中的魔术方法

在PHP中,以双下划线(__)开始命名的方法被称作PHP中的魔术方法,它们在PHP中充当很重要的角色。魔术方法包括:

方法名描述
__construct()类的构造函数
__destruct()类的析构函数
__call($funName, $arguments)当调用一个未定义或不可达方法时, __call() 方法将被调用。
__callStatic($funName, $arguments)当调用一个未定义或不可达的静态方法时, __callStatic() 方法将被调用。
__get($propertyName)当获取一个类的成员变量时, __get() 方法将被调用。
__set($property, $value)当赋值一个类的成员变量时, __set() 方法将被调用。
__isset($content)当调用 isset() 或 empty() 对一个未定义或不可达的成员赋值时, __isset() 方法将被调用。
__unset($content)当调用 reset() 对一个未定义或不可达的成员更新时, __unset() 方法将被调用。
__sleep()当执行序列化 serialize() 时,__sleep() 方法将首先被调用。
__wakeup()当执行反序列化 deserialization() 时, __wakeup() 方法将首先被调用。
__toString()当使用 echo 方法直接输出显示对象时,__toString() 方法首先被调用。
__invoke()使用调用函数(function)访问一个对象时, __invoke() 方法将首先被调用。
__set_state($an_array)当调用 var_export() 方法时,__set_state() 方法将被调用。
__clone()当对象被复制赋值时,__clone() 方法将被调用。
__autoload($className)试图载入一个未定义的类时调用。
__debugInfo()输出 debug 信息。

本文将使用一些实例展示 PHP 魔术方法的运用。

1.__construct()

当创建对象时,PHP 类的构造方法是第一个被调用的方法。每个类都有构造方法。若你没在类中明确声明定义它,将会有一个默认的无参类构造方法存在,虽然它不会在类中定义出现。

1) 构造方法的运用

类的构造方法通常用于执行一些初始化任务,诸如当创建对象时,为成员初始化赋值。

2) 类中构造方法的声明格式

function __constrct([parameter list]){    方法具体实现 //通常为成员变量初始赋值。}

注意: 在多数类中仅可以声明一个构造方法。因为, PHP 不支持构造方法重载。

下面是个完整的例子:

<?php    class Person    {                                                                                 public $name;                   public $age;                   public $sex;                                                                                                              public function __construct($name="", $sex="Male", $age=22)        {                 $this->name = $name;            $this->sex = $sex;            $this->age = $age;        }                public function say()        {            echo "Name:" . $this->name . ",Sex:" . $this->sex . ",Age:" . $this->age;        }       }

无参创建 $Person1 对象。

$Person1 = new Person();echo $Person1->say(); //显示:Name:,Sex:Male,Age:22

使用一个参数 "Jams" 调用创建 $Person2 对象。

$Person2 = new Person("Jams");echo $Person2->say(); // 显示: Name: Jams, Sex: Male, Age: 22

使用3个参数调用创建 $Person3 对象。

$Person3 = new Person ("Jack", "Male", 25);echo $Person3->say(); // 显示:Name: Jack, Sex: Male, Age: 25

__destruct()

析构函数与构造函数相反。

析构函数允许你在销毁对象之前执行一些操作,例如关闭文件,清空结果集等等。

析构函数是 PHP 5 引入的新功能。

析构函数的声明与构造函数类似,以两个下划线开头,名称固定为 __destruct()

析构函数的声明

function __destruct(){    //method body}

析构函数不能带参数。

析构函数的使用

析构函数在类中一般不常见。它是类的可选部分,通常用于在类销毁之前完成一些清理任务。

这是使用析构函数的示例:

<?phpclass Person{         public $name;             public $age;             public $sex;             public function __construct($name="", $sex="Male", $age=22)    {           $this->name = $name;        $this->sex  = $sex;        $this->age  = $age;    }        public function say()    {        echo "Name:".$this->name.",Sex:".$this->sex.",Age:".$this->age;    }           public function __destruct()    {            echo "Well, my name is ".$this->name;    }}$Person = new Person("John");unset($Person); //destroy the object of $Person created above

输出结果

Well, my name is John

__call()

该方法接受两个参数。第一个参数为未定义的方法名称,第二个参数则为传入方法的参数构成的数组

使用

function __call(string $function_name, array $arguments){    // method body}

在程序中调用未定义方法时, __call() 方法将被调用。

示例

<?phpclass Person{                                 function say()    {           echo "Hello, world!<br>";    }         function __call($funName, $arguments)    {          echo "The function you called:" . $funName . "(parameter:" ;  // Print the method's name that is not existed.          print_r($arguments); // Print the parameter list of the method that is not existed.          echo ")does not exist!!<br>\n";                       }                                         }$Person = new Person();           $Person->run("teacher"); // If the method which is not existed is called within the object, then the __call() method will be called automatically.$Person->eat("John", "apple");             $Person->say();

显示结果

The function you called: run (parameter: Array([0] => teacher)) does not exist!The function you called: eat (parameter: Array([0] => John[1] => apple)) does not exist!Hello world!

4. __callStatic()

当在程序中调用未定义的静态方法,__callStatic() 方法将会被自动调用。

__callStatic() 的用法类似于 __call() 。下面举个例子:

<?phpclass Person{    function say()    {        echo "Hello, world!<br>";    }    public static function __callStatic($funName, $arguments)    {        echo "The static method you called:" . $funName . "(parameter:" ;  // 打印出未定义的方法名。        print_r($arguments); // 打印出未定义方法的参数列表。        echo ")does not exist!<br>\n";    }}$Person = new Person();$Person::run("teacher"); // 如果此项目内不存在的方法被调用了,那么 __callStatic() 方法将被自动调用。$Person::eat("John", "apple");$Person->say();

执行结果如下:

The static method you called: run (parameter: Array([0] => teacher)) does not exist!The static method you called: eat (parameter: Array([0] => John[1] => apple)) does not exist!Hello world!

__get()

当你尝试在外部访问对象的私有属性时,应用程序将抛出异常并结束运行。我们可以使用 __get 方法解决该问题。该方法可以获取从对象外部获取私有属性的值。举例如下

<?phpclass Person{    private $name;    private $age;    function __construct($name="", $age=1)    {        $this->name = $name;        $this->age = $age;    }    public function __get($propertyName)    {           if ($propertyName == "age") {            if ($this->age > 30) {                return $this->age - 10;            } else {                return $this->$propertyName;            }        } else {            return $this->$propertyName;        }    }}$Person = new Person("John", 60);   // Instantiate the object with the Person class and assign initial values to the properties with the constructor.echo "Name:" . $Person->name . "<br>";   // When the private property is accessed, the __get() method will be called automatically,so we can get the property value indirectly.echo "Age:" . $Person->age . "<br>";    // The __get() method is called automatically,and it returns different values according to the object itself.

结果显示如下

Name: JohnAge: 50

6. __set()

set($property,$value)方法用于设置类的私有属性。分配了未定义的属性后,将触发set()方法,并且传递的参数是设置的属性名称和值。

下面是演示代码:

<?phpclass Person{    private $name;    private $age;    public function __construct($name="",  $age=25)    {        $this->name = $name;        $this->age  = $age;    }    public function __set($property, $value) {        if ($property=="age")        {            if ($value > 150 || $value < 0) {                return;            }        }        $this->$property = $value;    }    public function say(){        echo "My name is ".$this->name.",I'm ".$this->age." years old";    }}$Person=new Person("John", 25); //请注意,类初始化并为“name”和“age”分配初始值。$Person->name = "Lili";     // "name" 属性值被成功修改。如果没有__set()方法,程序将报错。$Person->age = 16; // "age"属性修改成功。$Person->age = 160; //160是无效值,因此修改失败。$Person->say();  //输出:My name is Lili, I'm 16 years old。

代码运行结果:

My name is Lili, I'm 16 years old

7. __isset()

在使用__isset()方法之前,让我先解释一下isset()方法的用法。isset()方法主要用于确定是否设置了此变量。

如果在对象外部使用isset()方法,则有两种情况:

  1. 如果该参数是公共属性,则可以使用isset()方法确定是否设置了该属性。

  2. 如果参数是私有属性,则isset()方法将不起作用。

那么对于私有属性,有什么办法知道它是否被设置了吗?当然,只要在类中定义__isset()方法,就可以在类外部使用isset()方法来确定是否设置了私有属性。

当在未定义或不可访问的属性上调用isset()或empty()时,将调用__isset()方法。下面是一个例子:

<?phpclass Person{    public $sex;    private $name;    private $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }        public function __isset($content) {        echo "The {$content} property is private,the __isset() method is called automatically.<br>";        echo  isset($this->$content);    }}$person = new Person("John", 25); // Initially assigned.echo isset($person->sex),"<br>";echo isset($person->name),"<br>";echo isset($person->age),"<br>";

代码运行结果如下:

1The name property is private,the __isset() method is called automatically.1The age property is private,the __isset() method is called automatically.1

8. __unset()

isset()方法类似,当在未定义或不可访问的属性上调用unset()方法时,将调用unset()方法。下面是一个例子:

<?phpclass Person{    public $sex;    private $name;    private $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }        public function __unset($content) {        echo "It is called automatically when we use the unset() method outside the class.<br>";        echo  isset($this->$content);    }}$person = new Person("John", 25); // Initially assigned.unset($person->sex),"<br>";unset($person->name),"<br>";unset($person->age),"<br>";

代码的运行结果如下:

It is called automatically when we use the unset() method outside the class.1It is called automatically when we use the unset() method outside the class.1

9. __sleep()

serialize()方法将检查类中是否有魔术方法__sleep()。如果存在,将首先调用该方法,然后执行序列化操作。

__sleep()方法通常用于指定保存数据之前需要序列化的属性。如果有一些非常大的对象不需要全部保存,那么您会发现此功能非常有用。

有关详细信息,请参考以下代码:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }        public function __sleep() {        echo "It is called when the serialize() method is called outside the class.<br>";        $this->name = base64_encode($this->name);        return array('name', 'age'); // It must return a value of which the elements are the name of the properties returned.    }}$person = new Person('John'); // Initially assigned.echo serialize($person);echo '<br/>';

代码运行结果如下:

It is called when the serialize() method is called outside the class.O:6:"Person":2:{s:4:"name";s:8:"5bCP5piO";s:3:"age";i:25;}

10. __wakeup()

sleep()方法相比,wakeup()方法通常用于反序列化操作,例如重建数据库连接或执行其他初始化操作。

下面是相关实例:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }        public function __sleep() {        echo "It is called when the serialize() method is called outside the class.<br>";        $this->name = base64_encode($this->name);        return array('name', 'age'); // It must return a value of which the elements are the name of the properties returned.    }        public function __wakeup() {        echo "It is called when the unserialize() method is called outside the class.<br>";        $this->name = 2;        $this->sex = 'Male';        // There is no need to return an array here.    }}$person = new Person('John'); // Initially assigned.var_dump(serialize($person));var_dump(unserialize(serialize($person)));

代码运行结果如下:

It is called when the serialize() method is called outside the class.string(58) "O:6:"Person":2:{s:4:"name";s:8:"5bCP5piO";s:3:"age";i:25;}"It is called when the unserialize() method is called outside the class.object(Person)#2 (3) { ["sex"]=> string(3) "Male" ["name"]=> int(2) ["age"]=> int(25) }

11. __toString()

使用echo方法直接打印对象时,将调用__toString()方法。

注意:此方法必须返回一个字符串,否则将在E_RECOVERABLE_ERROR级别上引发致命错误。而且您也不能在__toString()方法中抛出异常。

下面是相关的实例:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }    public function __toString()    {        return  'Go go go';    }}$person = new Person('John'); // Initially assigned.echo $person;

运行代码结果如下:

go go go

那么,如果在类中未定义__toString()方法怎么办?让我们尝试一下。

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }}$person = new Person('John'); // Initially assigned.echo $person;

运行代码结果如下:

Catchable fatal error: Object of class Person could not be converted to string in D:\phpStudy\WWW\test\index.php on line 18

显然,它在页面上报告了一个致命错误,PHP语法不支持这样的写法。

12. __invoke()

当您尝试以调用函数的方式调用对象时,__ invoke()方法将被自动调用。

注意:此功能仅在PHP 5.3.0及更高版本中有效。

下面是相关实例:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }    public function __invoke() {        echo 'This is an object';    }}$person = new Person('John'); // Initially assigned.$person();

运行代码结果如下:

This is an object

如果坚持使用对象作为方法(但未定义__invoke()方法),则将得到以下结果:

Fatal error: Function name must be a string in D:\phpStudy\WWW\test\index.php on line 18

13.__set_state()

从PHP 5.1.0开始,在调用var_export()导出类代码时会自动调用__set_state()方法。

__set_state()方法的参数是一个包含所有属性值的数组,其格式为array('property'=> value,...)

在以下示例中,我们没有定义__set_state()方法:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }}$person = new Person('John'); // Initially assigned.var_export($person);

执行代码结果如下:

Person::__set_state(array( 'sex' => 'Male', 'name' => 'John', 'age' => 25, ))

显然,对象的属性已打印。

现在让我们看看定义__set_state()方法的另一种情况:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }    public static function __set_state($an_array)    {        $a = new Person();        $a->name = $an_array['name'];        return $a;    }}$person = new Person('John'); // Initially assigned.$person->name = 'Jams';var_export($person);

执行代码结果如下:

Person::__set_state(array( 'sex' => 'Male', 'name' => 'Jams', 'age' => 25, ))

14. __clone()

在PHP中,我们可以使用clone关键字通过以下语法克隆对象:

$copy_of_object = clone $object;

但是,使用clone关键字只是一个浅拷贝,因为所有引用的属性仍将指向原始变量。

如果在对象中定义了clone()方法,则将在复制生成的对象中调用clone()方法,该方法可用于修改属性的值(如有必要)。

下面是相关的示例:

<?phpclass Person{    public $sex;    public $name;    public $age;    public function __construct($name="",  $age=25, $sex='Male')    {        $this->name = $name;        $this->age  = $age;        $this->sex  = $sex;    }    public function __clone()    {        echo __METHOD__."your are cloning the object.<br>";    }}$person = new Person('John'); // Initially assigned.$person2 = clone $person;var_dump('persion1:');var_dump($person);echo '<br>';var_dump('persion2:');var_dump($person2);

运行代码结果如下:

Person::__clone your are cloning the object.string(9) "persion1:" object(Person)#1 (3) { ["sex"]=> string(3) "Male" ["name"]=> string(6) "John" ["age"]=> int(25) }string(9) "persion2:" object(Person)#2 (3) { ["sex"]=> string(3) "Male" ["name"]=> string(6) "John" ["age"]=> int(25) }

15.__autoload()

__autoload()方法可以尝试加载未定义的类。

过去,如果要在程序文件中创建100个对象,则必须使用include()或require()来包含100个类文件,或者必须在同一类文件中定义100个类。 例如以下:

require_once('project/class/A.php');require_once('project/class/B.php');require_once('project/class/C.php');...if (ConditionA) {    $a = new A();    $b = new B();    $c = new C();    // …} else if (ConditionB) {    $a = newA();    $b = new B();    // …}

那么,如果我们使用__autoload()方法呢?

function  __autoload($className) {    $filePath = “project/class/{$className}.php”;    if (is_readable($filePath)) {        require($filePath);    }}if (ConditionA) {    $a = new A();    $b = new B();    $c = new C();    // …} else if (ConditionB) {    $a = newA();    $b = new B();    // …}

当PHP引擎第一次使用类A时,如果未找到类A,则autoload方法将被自动调用,并且类名称“ A”将作为参数传递。因此,我们在autoload()方法中需要做的是根据类名找到相应的类文件,然后将其包含在内。如果找不到该文件,则php引擎将抛出异常。

16. __debugInfo()

当执行 var_dump() 方法时,__debugInfo() 方法会被自动调用。如果 __debugInfo() 方法未被定义,那么 var_dump 方法或打印出这个对象的所有属性。

举例说明:

<?phpclass C {    private $prop;    public function __construct($val) {        $this->prop = $val;    }        public function __debugInfo() {        return [            'propSquared' => $this->prop ** 2,        ];    }}var_dump(new C(42));

执行结果:

object(C)#1 (1) { ["propSquared"]=> int(1764) }

注意:__debugInfo() 方法应该在 PHP 5.6.0 及以上版本中使用。

关于“php魔术方法有哪些及怎么使用”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注编程网PHP编程频道,小编每天都会为大家更新不同的知识点。

--结束END--

本文标题: php魔术方法有哪些及怎么使用

本文链接: https://www.lsjlt.com/news/347964.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • php魔术方法有哪些及怎么使用
    这篇文章主要介绍“php魔术方法有哪些及怎么使用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“php魔术方法有哪些及怎么使用”文章能帮助大家解决问题。PHP中以双下划线“__”开始命名的内置方法被称...
    99+
    2023-07-04
  • php中的魔术方法有哪些及怎么用
    这篇文章主要讲解了“php中的魔术方法有哪些及怎么用”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“php中的魔术方法有哪些及怎么用”吧!php中魔术方法详解,在php中有一类方法,很奇怪常,...
    99+
    2023-06-30
  • PHP有哪些魔术方法
    这篇文章主要为大家展示了“PHP有哪些魔术方法”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“PHP有哪些魔术方法”这篇文章吧。PHP是一门非常优秀的脚本编程语言,与其它编程语言有一个非常不同的地...
    99+
    2023-06-04
  • php中魔术方法都有哪些
    本教程操作环境:windows7系统、PHP7.1版、DELL G3电脑在面向对象编程中,PHP 提供了一系列的魔术方法,这些魔术方法为编程提供了很多便利,在 PHP 中的作用是非常重要的。PHP 中的魔术方法通常以__(两个下划线)开始,...
    99+
    2021-12-03
    php 魔术方法
  • php语言中有哪些魔术方法
    这篇文章主要介绍php语言中有哪些魔术方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!php魔术方法有:“__set()”、“__get()”、“__isset()”、“__unset()”、“__sleep()”...
    99+
    2023-06-22
  • python魔术方法有哪些
    python魔术方法有哪些?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。一、类和对象通俗理解:类就是模板,对象就是通过模板创造出来的物体类(Class)由3个部...
    99+
    2023-06-15
  • php7有哪些魔术方法
    本篇内容介绍了“php7有哪些魔术方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!php7魔术方法有:1、“__constract”方法;...
    99+
    2023-06-22
  • 常见的PHP魔术方法类有哪些
    这篇文章主要讲解了“常见的PHP魔术方法类有哪些”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“常见的PHP魔术方法类有哪些”吧!__construct()方法__construct()方法是...
    99+
    2023-07-05
  • php魔术方法有什么用
    这篇文章将为大家详细讲解有关php魔术方法有什么用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。php魔术方法的作用:1、【__construct()】实例化对象时自动调用;2、【__destruct()...
    99+
    2023-06-06
  • PHP的魔术方法怎么用
    本篇内容介绍了“PHP的魔术方法怎么用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!在PHP中,以双下划线(__)开始命名的方法被称作PHP...
    99+
    2023-06-30
  • python中有哪些常用的魔术方法
    这篇文章将为大家详细讲解有关python中有哪些常用的魔术方法,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。Python的优点有哪些1、简单易用,与C/C++、Java、C# 等传统语言相比...
    99+
    2023-06-14
  • php中有哪些魔幻方法
    今天就跟大家聊聊有关php中有哪些魔幻方法,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。魔幻方法有:“__construct()”、“__destruct()”、“__set()”、...
    99+
    2023-06-20
  • php反序列化魔术方法怎么使用
    在PHP中,反序列化是通过魔术方法__wakeup()来实现的。__wakeup()方法会在反序列化对象时自动调用。 使用魔术方法_...
    99+
    2023-10-22
    php
  • 常用的Python魔法方法有哪些
    这期内容当中小编将会给大家带来有关常用的Python魔法方法有哪些,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。一、算数运算符的魔法方法python2.2以后,对类和类型进行了统一,做法就是讲int()、...
    99+
    2023-06-15
  • 【PHP面试题75】PHP有哪些魔术变量,如何使用他们?
    文章目录 一、前言二、魔术变量2.1 __LINE__2.2 __FILE__2.3 __DIR__2.4 __FUNCTION__2.5 __CLASS__2.6 __TRAIT__2.7 ...
    99+
    2023-09-24
    php 开发语言 魔术变量
  • jQuery中Ajax的方法有哪些及怎么使用
    这篇文章主要介绍“jQuery中Ajax的方法有哪些及怎么使用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“jQuery中Ajax的方法有哪些及怎么使用”文章能帮助大家解决问题。一、Ajax 的优势...
    99+
    2023-06-29
  • php页面提交方式有哪些及怎么使用
    这篇文章主要介绍了php页面提交方式有哪些及怎么使用的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇php页面提交方式有哪些及怎么使用文章都会有所收获,下面我们一起来看看吧。php页面数据提交方式有get和pos...
    99+
    2023-07-04
  • python魔法方法 __ slots __怎么使用
    这篇文章主要讲解了“python魔法方法 __ slots __怎么使用”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“python魔法方法 __&nb...
    99+
    2023-07-05
  • php static的使用方法有哪些
    这篇文章主要介绍“php static的使用方法有哪些”,在日常操作中,相信很多人在php static的使用方法有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”php static的使用方法有哪些”的疑...
    99+
    2023-06-20
  • 怎么使用PHP常用的八个魔术常量
    这篇文章主要介绍“怎么使用PHP常用的八个魔术常量”,在日常操作中,相信很多人在怎么使用PHP常用的八个魔术常量问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么使用PHP常用的八个魔术常量”的疑惑有所帮助!...
    99+
    2023-06-25
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作