加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

Opencart如何在php循环中添加语言文件中的所有内容

发布时间:2020-12-13 13:26:05 所属栏目:PHP教程 来源:网络整理
导读:有没有办法从Opencart语言中读取所有内容? 目前我必须: Controller$this-load-language('help'); $this-data['heading_title'] = $this-language-get('heading_title'); $this-data['tab1'] = $this-language-get('tab1'); 语言文件 ?php// Heading$_['hea
有没有办法从Opencart语言中读取所有内容?

目前我必须:

Controller
$this->load->language('help');          
$this->data['heading_title'] = $this->language->get('heading_title');    
$this->data['tab1'] = $this->language->get('tab1');

语言文件

<?php
// Heading
$_['heading_title']      = 'Help';
$_['tab1'] = 'Account';    
?>
最简单的方法是在控制器顶部使用数组合并
$this->data = array_merge($this->data,$this->language->load('language/file'));

或简单地说

$this->data += $this->language->load('language/file');

编辑

对于2.x,请使用

$data = array_merge($this-> data,$this-> language-> load(‘language / file’));

3.x自动执行此操作

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读