php-interface uses

Source: Internet
Author: User
<?php/*1. Using interfaces (interface), you can specify which methods a class must implement, but you do not need to define the specifics of these methods. 2. The interface is defined by the interface keyword, just like defining a standard class, but all of the methods defined in it are empty. 3. All methods defined in the interface must be public, which is the attribute of the interface. 4. To implement an interface, use the implements operator. All methods defined in the interface must be implemented in the class, or a fatal error will be reported. A class can implement multiple interfaces, separating the names of multiple interfaces with commas */interface httpprotocal{const $PI = 3.14;        } Interface Protocal extends Httpprotocal{public function protocal ();} Class Indexcontoller implements Protocal{public function Protocal () {}} #echo Indexcontoller::P i;? >

  

php-interface uses

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.