From 1a37e9b856293172a0ee888017d635ef27ee8723 Mon Sep 17 00:00:00 2001 From: unknown <510873001@qq.com> Date: Tue, 17 May 2022 14:54:00 +0800 Subject: [PATCH 1/3] cc --- .../20220510-php\347\254\254\344\270\200\347\253\240.md" | 0 ...44\272\214\347\253\240\350\277\220\347\256\227\347\254\246.md" | 0 ...47\254\254\344\270\211\347\253\240\346\225\260\347\273\204.md" | 0 "\351\231\210\351\233\205\346\245\240/20220517-php.md" | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename "\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.php" => "\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.md" (100%) rename "\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240.php" => "\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240\350\277\220\347\256\227\347\254\246.md" (100%) rename "\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240.php" => "\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240\346\225\260\347\273\204.md" (100%) create mode 100644 "\351\231\210\351\233\205\346\245\240/20220517-php.md" diff --git "a/\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.php" "b/\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.md" similarity index 100% rename from "\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.php" rename to "\351\231\210\351\233\205\346\245\240/20220510-php\347\254\254\344\270\200\347\253\240.md" diff --git "a/\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240.php" "b/\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240\350\277\220\347\256\227\347\254\246.md" similarity index 100% rename from "\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240.php" rename to "\351\231\210\351\233\205\346\245\240/20220511-php\347\254\254\344\272\214\347\253\240\350\277\220\347\256\227\347\254\246.md" diff --git "a/\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240.php" "b/\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240\346\225\260\347\273\204.md" similarity index 100% rename from "\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240.php" rename to "\351\231\210\351\233\205\346\245\240/20220516-php\347\254\254\344\270\211\347\253\240\346\225\260\347\273\204.md" diff --git "a/\351\231\210\351\233\205\346\245\240/20220517-php.md" "b/\351\231\210\351\233\205\346\245\240/20220517-php.md" new file mode 100644 index 0000000..e69de29 -- Gitee From 813254bd5ab4b4d09af40e5e7730977c7f7eb06a Mon Sep 17 00:00:00 2001 From: unknown <510873001@qq.com> Date: Tue, 17 May 2022 17:39:01 +0800 Subject: [PATCH 2/3] cc --- .../20220517-php.md" | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git "a/\351\231\210\351\233\205\346\245\240/20220517-php.md" "b/\351\231\210\351\233\205\346\245\240/20220517-php.md" index e69de29..6515d83 100644 --- "a/\351\231\210\351\233\205\346\245\240/20220517-php.md" +++ "b/\351\231\210\351\233\205\346\245\240/20220517-php.md" @@ -0,0 +1,176 @@ +brand=$brand; + $this->price=$price; + }//魔术构造 + +// function cars(){ +// echo $this->brand.$this->price; +// } + + + /** + * @return mixed + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param mixed $price + */ + public function setPrice($price) + { + $this->price = $price; + } + + /** + * @return mixed + */ + public function getBrand() + { + return $this->brand; + } + + /** + * @param mixed $brand + */ + public function setBrand($brand) + { + $this->brand = $brand; + } +} + + +$masha=new car("玛莎拉蒂",133333); + +$a="我有一辆豪车,它是一辆".$masha->getBrand().",它的价格为".$masha->getPrice()."刀"; +echo $a; +echo "\t\t"; + + +class paocar extends car{ + function __construct($brand, $price) + { + parent::__construct($brand, $price); + } + + function run(){ + echo "我有一辆跑车它会跑,它是一辆"; + } +} + + +$fll=new paocar("法拉利",223333); + +echo $fll->run(); +echo $fll->getBrand().",它的价格为:".$fll->getPrice()."刀"; + + + + + + + + + +//3、 定义一个类,分别定义3个公共的属性和方法,3个受保护的属性和方法,3个私有属性和方法。 +class dog{ + public $name; + public $age; + public $sex; + + protected $color; + protected $run; + protected $sleep; + + private $var; + private $length; + private $character; + + function eat(){ + echo "它吃狗粮"; + } + function drunk(){ + echo "它喝牛奶"; + } + function la(){ + echo "它会自己上厕所"; + } + + + + function __construct($var,$length,$character){ + $this->var=$var; + $this->length=$length; + $this->character=$character; + } + + /** + * @return mixed + */ + public function getVar() + { + return $this->var; + } + + /** + * @param mixed $var + */ + public function setVar($var) + { + $this->var = $var; + } + + /** + * @return mixed + */ + public function getLength() + { + return $this->length; + } + + /** + * @param mixed $length + */ + public function setLength($length) + { + $this->length = $length; + } + + /** + * @return mixed + */ + public function getCharacter() + { + return $this->character; + } + + /** + * @param mixed $character + */ + public function setCharacter($character) + { + $this->character = $character; + } + + +} + +$dogs=new dog("茶杯犬","15cm","害羞"); +$dogs->name="喵喵"; +$dogs->age=2; +$dogs->sex="母"; +echo $dogs->name.$dogs->eat().$dogs->drunk().$dogs->la(); +$d= ".有一只".$dogs->getVar().",它的全身长度只有".$dogs->getLength().",它性格比较".$dogs->getCharacter(); +echo $d; \ No newline at end of file -- Gitee From 36072afbe3073911a9313e3956e3c9bf3f238459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=9B=85=E6=A5=A0?= <510873001@qq.com> Date: Tue, 17 May 2022 21:02:37 +0800 Subject: [PATCH 3/3] cc --- ...42\345\220\221\345\257\271\350\261\241.md" | 96 +++++-------------- 1 file changed, 23 insertions(+), 73 deletions(-) rename "\351\231\210\351\233\205\346\245\240/20220517-php.md" => "\351\231\210\351\233\205\346\245\240/20220517-php\347\254\254\345\233\233\347\253\240\351\235\242\345\220\221\345\257\271\350\261\241.md" (55%) diff --git "a/\351\231\210\351\233\205\346\245\240/20220517-php.md" "b/\351\231\210\351\233\205\346\245\240/20220517-php\347\254\254\345\233\233\347\253\240\351\235\242\345\220\221\345\257\271\350\261\241.md" similarity index 55% rename from "\351\231\210\351\233\205\346\245\240/20220517-php.md" rename to "\351\231\210\351\233\205\346\245\240/20220517-php\347\254\254\345\233\233\347\253\240\351\235\242\345\220\221\345\257\271\350\261\241.md" index 6515d83..d19bcd0 100644 --- "a/\351\231\210\351\233\205\346\245\240/20220517-php.md" +++ "b/\351\231\210\351\233\205\346\245\240/20220517-php\347\254\254\345\233\233\347\253\240\351\235\242\345\220\221\345\257\271\350\261\241.md" @@ -1,5 +1,4 @@ -price; } - + /** * @param mixed $price */ @@ -33,7 +32,7 @@ class car{ { $this->price = $price; } - + /** * @return mixed */ @@ -41,7 +40,7 @@ class car{ { return $this->brand; } - + /** * @param mixed $brand */ @@ -49,6 +48,7 @@ class car{ { $this->brand = $brand; } + } @@ -68,6 +68,7 @@ class paocar extends car{ function run(){ echo "我有一辆跑车它会跑,它是一辆"; } + } @@ -75,6 +76,7 @@ $fll=new paocar(" echo $fll->run(); echo $fll->getBrand().",它的价格为:".$fll->getPrice()."刀"; +```` @@ -84,7 +86,10 @@ echo $fll->getBrand().", -//3、 定义一个类,分别定义3个公共的属性和方法,3个受保护的属性和方法,3个私有属性和方法。 + + +```php +//3、 定义一个类,分别定义3个公共的属性和方法,3个受保护的属性和方法,3个私有属性和方法。 class dog{ public $name; public $age; @@ -94,83 +99,28 @@ class dog{ protected $run; protected $sleep; - private $var; + private $vars; private $length; private $character; - function eat(){ + public function eat(){ echo "它吃狗粮"; } - function drunk(){ + public function drunk(){ echo "它喝牛奶"; } - function la(){ + public function la(){ echo "它会自己上厕所"; } + protected function color(){} + protected function run(){} + protected function sleep(){} - function __construct($var,$length,$character){ - $this->var=$var; - $this->length=$length; - $this->character=$character; - } - - /** - * @return mixed - */ - public function getVar() - { - return $this->var; - } - - /** - * @param mixed $var - */ - public function setVar($var) - { - $this->var = $var; - } - - /** - * @return mixed - */ - public function getLength() - { - return $this->length; - } - - /** - * @param mixed $length - */ - public function setLength($length) - { - $this->length = $length; - } - - /** - * @return mixed - */ - public function getCharacter() - { - return $this->character; - } - - /** - * @param mixed $character - */ - public function setCharacter($character) - { - $this->character = $character; - } - - + private function vars(){} + private function length(){} + private function character(){ + } } - -$dogs=new dog("茶杯犬","15cm","害羞"); -$dogs->name="喵喵"; -$dogs->age=2; -$dogs->sex="母"; -echo $dogs->name.$dogs->eat().$dogs->drunk().$dogs->la(); -$d= ".有一只".$dogs->getVar().",它的全身长度只有".$dogs->getLength().",它性格比较".$dogs->getCharacter(); -echo $d; \ No newline at end of file +``` \ No newline at end of file -- Gitee