Haskey()
意义: 是否有关键字
语法: boolean hasKey (key $key) key $key: The key to check 实际应用:
jimport('joomla.language.language'); $temp =& new jlanguage;
$tem = $temp->haskey('en-GB'); print_r($tem);
结果: True, if the key exists
Load()
意义: 对现有的字符串装载一个唯一语言文件和添加结果
语法: boolean load ([string $extension = 'joomla'], [string $basePath = JPATH_BASE], [string $lang = null], [boolean $reload = false]) string $extension: The extension for which a language file should be loaded string $basePath: The basepath to use string $lang: The language to load, default null for the current language boolean $reload: Flag that will force a language to be reloaded if set to true 实际应用:
jimport('joomla.language.language'); $temp =& new jlanguage; $tem = $temp->load(); print_r($tem);
结果: True, if the file has successfully loaded.
JRegistry API Package Home Joomla.Framework $tem = $temp->getwincp(); print_r($tem); 结果: iso-8859-1
Method __construct getNameSpaces getValue loadArray loadFile loadINI loadObject loadXML makeNameSpace Merge setValue toArray toObject toString __clone Description 构造函数 得到namespaces列表 得到注册值 装载数组到默认的namespace 装载文件目录 装载INI 串到注册的namespace 装载对象的公共变量到默认的namespace 装载 XML 串到注册的namespace 创建一个namespace 合并一个JRegistry对象到一个 设置注册值 翻译一个namespace到一个数组 翻译一个namespace到一个对象 在一个给定的字符格式得到namespace
getNameSpaces()
意义: 得到namespaces列表 语法: array getNameSpaces () 实际应用:
jimport('joomla.registry.registry'); $temp =& new jregistry;
$tem = $temp->getnamespaces(); echo $tem;
getValue()
意义: 得到注册值
语法: mixed getValue (string $regpath, [mixed $default = null]) string $regpath: Registry path (e.g. joomla.content.showauthor) mixed $default: Optional default value 实际应用:
jimport('joomla.registry.registry'); $temp =& new jregistry;
$temp->setValue('joomla.content.showauthor',true); $temp->setValue('joomla.debug',false);
$temp->setValue('joomla.limit',25);
$tem = $temp->getValue('joomla.content.showauthor'); print_r($tem);
loadArray()
意义: 装载数组到默认的namespace
语法: boolean loadArray (array $array, [ $namespace = null], string $namepsace) array $array: Associative array of value to load string $namepsace: The name of the namespace $namespace 实际应用:
jimport('joomla.registry.registry'); $temp =& new jregistry;
$file = array('showauthor'=>true,'showmail'=>false,'listitem'=>30); if($temp->loadArray($file)) echo \
loadFile()
意义: 装载文件目录
语法: boolean loadFile (string $file, [string $format = 'INI'], [string $namespace = null]) string $file: Path to file to load string $format: Format of the file [optional: defaults to INI] string $namespace: Namespace to load the INI string into [optional] 实际应用:
jimport('joomla.registry.registry'); $temp =& new jregistry;
$file = (JPATH_SITE.DS.'language'.DS.'en-GB'.DS.'en-GB.ini'); if($temp->loadfile($file)) echo 'loaded';
loadINI()
意义装载INI 串到注册的namespace:
语法: boolean loadINI (string $data, [string $namespace = null]) string $data: INI formatted string to load into the registry string $namespace: Namespace to load the INI string into [optional] 实际应用:
jimport('joomla.registry.registry'); $temp =& new jregistry;
jimport('joomla.filesystem.file');
$date = JFile::read(JPATH_SITE.DS.'language'.DS.'en-GB'.DS.'en-GB.ini');
if($temp->loadINI($date)) echo \
loadObject()
意义装载对象的公共变量到默认的namespace:
语法: boolean loadObject ( &$object, [string $namespace = null], object $object) object $object: The object holding the public vars to load string $namespace: Namespace to load the INI string into [optional] $&object 实际应用:
jimport('joomla.registry.registry'); $object = new stdClass(); $object->name=\ $object->city=\ $object->sex=\
$temp =& new JRegistry('example'); $temp->loadobject($object);
echo $temp->getValue('example.name');
makeNameSpace()
意义: 创建一个namespace
语法: boolean makeNameSpace (string $namespace) string $namespace: Name of the namespace to create 实际应用:
jimport('joomla.registry.registry'); $temp =& new JRegistry();
$temp->makenamespace('joomla');
$data=array('name'=>'bob','address'=>'123 upst'); $temp->loadArray($data,'joomla');
print_r($temp->getvalue('joomla.name'));
toArray()
意义: 翻译一个namespace到一个数组
语法: array toArray ([string $namespace = null]) string $namespace: Namespace to return [optional: null returns the default namespace] 实际应用:
相关推荐: