©
This document uses PHP Chinese website manual Release
(Yaf >=1.0.0)
Yaf_Loader::registerLocalNamespace — 注册本地类前缀
$prefix
] )register local class prefix
prefix
字符串或者是数组格式的类名前缀,所有拥有和这些前缀相同前缀的类将被加载到本地library路径。
bool
Example #1 Yaf_Loader::registerLocalNamespace() example
<?php
$loader = Yaf_Loader :: getInstance ( '/local/library/' , '/global/library' );
$loader -> registerLocalNamespace ( "Baidu" );
$loader -> registerLocalNamespace (array( "Sina" , "Weibo" );
$loader -> autoload ( "Baidu_Name" ); // search in '/local/library/'
$loader -> autoload ( "Sina" ); // search '/local/library/'
$loader -> autoload ( "Global_Name" ); // search in '/global/library/'
$loader -> autoload ( "Foo_Bar" ); // search in '/global/library/'
?>