opencart内的php基础问题$_[‘ ‘]
语言包内的php代码:
$_[‘heading_title’]=’hello’;
控制器:
$this->data[‘heading_title’]=$this->language->get(‘heading_title’);
视图:
<?php $heading_title ?>将变成hello
这里将语言包内的hello传递给视图内%本文@来源gao@!dai!ma.com搞$$代^@码!网搞代gaodaima码的变量$heading_titile;
这里的 $_[”] ,是什么意思?为什么可以用get(‘heading_title’)来得到’hello‘为什么可以这样表示 $_ ?
——解决方案——————–
$_ 是变量名
至于 为什么可以用get(‘heading_title’)来得到’hello
可以去参考它的文档
——解决方案——————–
language 是一个对象,就是你说的语言包
当访问语言包时 $this->language->get(‘heading_title’)
实际访问的是 $_[‘heading_title’]
内部实现请分析相关代码