PHP头条
热点:

opencart内的php基础有关问题$_['']


opencart内的php基础问题$_[' ']
语言包内的php代码:
$_['heading_title']='hello';

控制器:
$this->data['heading_title']=$this->language->get('heading_title');
视图:
将变成hello 

这里将语言包内的hello传递给视图内的变量$heading_titile;
这里的 $_[''] ,是什么意思?为什么可以用get('heading_title')来得到’hello‘为什么可以这样表示 $_ ?

------解决方案--------------------
$_ 是变量名

至于 为什么可以用get('heading_title')来得到’hello
可以去参考它的文档
------解决方案--------------------
language 是一个对象,就是你说的语言包
当访问语言包时 $this->language->get('heading_title')
实际访问的是 $_['heading_title']
内部实现请分析相关代码

www.phpzy.comtrue/phprm/25267.htmlTechArticleopencart内的php基础有关问题$_[''] opencart内的php基础问题$_[' '] 语言包内的php代码: $_['heading_title']='hello'; 控制器: $this->data['heading_title']=$this->language->get('heading_title'); 视图: 将变成hell...

相关文章

PHP之友评论

今天推荐