PHP namespace instance description_php tutorial-PHP Tutorial

Source: Internet
Author: User
PHP namespace instance description. Copy the code as follows: namespacebakbaba; functionbab () {echobi;} namespacekkk; functionk1 () {echok1;} bakbababab (); use another namespace in the kkk namespace The code is as follows:


Namespace bak \ ba;
Function bab (){
Echo "bi ";
}
Namespace kkk;
Function k1 (){
Echo "k1 ";
}
\ Bak \ ba \ bab (); // use another namespace in the kkk namespace. pay attention to the previous \
Use \ bak \ ba as B; // it is still in the kkk namespace, but the following method is correct when using an alias
# Use bak \ ba as B; // do not use the \ ID
B \ bab (); // when the namespace under the alias is used, the \ id should not exist before it
K1 (); // no error is returned when this function is called, indicating that use does not affect the current namespace

The http://www.bkjia.com/PHPjc/322793.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322793.htmlTechArticle code is as follows: namespace bak \ ba; function bab () {echo "bi" ;}namespace kkk; function k1 () {echo "k1 ";} \ bak \ ba \ bab (); // use another name in the kkk namespace...

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.