leo列

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

统计

php---笔记

1.php放在<?php.................................?>里面就相当于JS放在<script></script>里面

2.acho "abc";   就相当于document.write("abc"); 字符串两边可以不加引号

3.$a=12相当于var a =12;

4.+号在JS里面有 加法和字符串连接2种功能,在PHP里面只有加法功能  而字符串连接用“.”号

5.JS里面的“的”用“.”号表示,在PHP中“的”用“->”这个符号

6.pHP中的继承

复制代码
class Person{
     function __construct($name,$sex)
     {
          $this->name=$name;
          $this->sex=$sex;
     }                                              //定义类的属性
     function showName()
     {
         echo $this->name;              //定义类的showName方法
     }
     function showSex()
    {
         echo $this->sex;                 //定义类的showSex方法
    }
 }
 
 class Worker extends Person{
     function __construct($name,$sex,$job)
     {
           parent::__construct($name,$sex);   //调用Person构造                           函数,继承Person
     }
 }
复制代码

posted on   leo列  阅读(189)  评论(0编辑  收藏  举报

点击右上角即可分享
微信分享提示