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...