codecamp

CodeIgniter 语言辅助函数

语言辅助函数

语言辅助函数文件包含了用于处理语言文件的一些函数。

加载辅助函数

该辅助函数通过下面的代码加载:

$this->load->helper('language');

可用函数

该辅助函数有下列可用函数:

lang($line[, $for = ''[, $attributes = array()]])

参数:

  • $line (string) -- Language line key
  • $for (string) -- HTML "for" attribute (ID of the element we're creating a label for)
  • $attributes (array) -- Any additional HTML attributes

返回: HTML-formatted language line label

返回类型: string

此函数使用简单的语法从已加载的语言文件中返回一行文本。 这种简单的写法在视图文件中可能比调用 CI_Lang::line() 更顺手。

Example:

echo lang('language_key', 'form_item_id', array('class' => 'myClass'));
// Outputs: <label for="form_item_id" class="myClass">Language line</label>
CodeIgniter HTML 辅助函数
CodeIgniter Inflector 辅助函数
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }