<code><span><span><?php </span>header(<span>"Content-Type: text/html; charset=utf-8"</span>);<span>//去除中文乱码</span><span>/** * 1.parent关键字可以用于调用父类中被重写了的方法 * 2.self关键字可以用于访问类自身的成员方法、静态方法和类常量,自身属性不能被访问;使用常量的时候,常量名称不需要加$ * 3.static关键字用于访问类自身定义的静态成员,访问静态属性时需要在属性前加$ */</span><span><span>class</span><span>BaseClass</span>{</span><span>public</span><span><span>function</span><span>test</span><span>()</span>{</span><span>echo</span><span>"BaseClass::test called.<br>"</span>; } <span>public</span><span><span>function</span><span>test1</span><span>()</span>{</span><span>echo</span><span>"BaseClass::test1 called.<br>"</span>; } } <span><span>class</span><span>ChildClass</span><span>extends</span><span>BaseClass</span> {</span><span>const</span> C>"类中定义的一个const常量"</span>; <span>private</span><span>static</span><span>$staticValue</span>=<span>"这是类的static常量"</span>; <span>public</span><span><span>function</span><span>test</span><span>(<span>$value</span>=null)</span>{</span><span>//没有默认值会报错</span><span>echo</span><span>"ChildClass::test called "</span>.<span>$value</span>.<span>"<br>"</span>; <span>echo</span><span>parent</span>::test();<span>//调用被重写的父类方法</span><span>self</span>::called(); <span>echo</span><span>self</span>::CONST_VALUE.<span>"<br>"</span>; <span>echo</span><span>self</span>::<span>$staticValue</span>.<span>"<br>"</span>; } <span>public</span><span><span>function</span><span>called</span><span>()</span>{</span><span>echo</span><span>"类的一个方法"</span>.<span>"<br>"</span>; } } <span>$obj</span>=<span>new</span> ChildClass(); <span>$obj</span>->test(<span>"'222'"</span>); <span>//$obj->test1();</span><span>?></span></span></code>
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces object-oriented PHP (3), including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

LeicareleasedtheLeicaLuxcameraappfortheAppleiPhoneafewdaysago.However,theappwasnotdevelopedbyLeica,butbyFjorden.ThecompanyhasbeenknownprimarilyforitscameragripsfortheiPhoneandwasacquiredbyLeicainDecember2023.Fo

SincethedemiseofLogitech'spopularHarmonyremotecontrols,themarketforhigh-qualityuniversalremotecontrolshasbeenfragmentedatbest.UnfoldedCircleaimstoavoidthefateoftheHarmonyUltimatebyeliminatinganyserverobligationsorsubs

Anintriguingthird-partycasefortheGalaxyS24Ultra(curr.$1,099.99onAmazon)hasappearedonmarketplaceslikeAliExpress.Astheimagesthroughoutthisarticleshow,thecasehasasimplesiliconeconstruction.However,italsocontainsanEInkd

In2012,theeminentautomotivejournalistJeremyClarksonstatedthattheLamborghiniAventador,whichhewasreviewingatthetime,wouldbeamongthelastcarstofeatureanaturallyaspiratedV12.Morethanadecadelater,V12-poweredsupercarsareal

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

Audio-TechnicahasunveiledtheATH-S300BTwirelessheadphoneswithhear-throughnoise-cancellation,multipointpairing,and90hoursofbatterylife.Thenoise-cancellingfeaturehasthreemodes:off,on,andhear-through,whereambientsoundscanbehea

Backin2022,whenPCIe7.0wasstartingtotakeshapeasafuturestandard,PCIe5.0wasjusthittingtheservermarketsandtheprospectofseeingPCIe6.0devicesavailableanytimesoon,letalonePCIe7.0ones,wasquitefar-fetched.CurrentlyPCIe5

TheJabraEliteserieshascometoanend,withGNCEOPeterKarlstromerannouncingthediscontinuationofthewirelessearbudswithinthelineupinapressrelease.Petersaysthatthechangingmarketdynamicsandhowchallengingithasbecometogetas


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.