PHP 7.1.21 Released

Yaf_Loader::registerLocalNamespace

(Yaf >=1.0.0)

Yaf_Loader::registerLocalNamespace注册本地类前缀

说明

public void Yaf_Loader::registerLocalNamespace ([ mixed $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/'

?>
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top