namespace(命名空间)相当于函数、类,划分了一个区域,这样子就使得在同个页面中可以require相同的类,使用相同名字的函数 : 在项目中比较少用
//name.php<?php//命名要使用复合名称namespaceme\mine;
classme{publicfunction__construct(){echo'name'.'<br>';
}
publicfunctionname(){echo'i use space'.'<br>';
}
}
//$me = new me();functionme(){echo'is me'.'<br>';
}//common.php<?phpclassme{publicfunction__construct(){echo'no namespace'.'<br>';
}
}<?php//建议使用别名useme\mineasi; require'./name.php'; require'./common.php'; $me = new i\me(); $me->name(); i\me(); $com = new me();

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了PHP之namespace,包括了espace方面的内容,希望对PHP教程有兴趣的朋友有所帮助。











