Tro*_*ong 0 frameworks codeigniter
在控制器类中,我有这个功能:
public function index(){
    $this->load->helper('url');
    $data['title'] = 'News archive';
    $this->load->view('news/index', $data);
}
我加载了帮助URL,因为我在news/index中使用了anchor().所以看起来在父函数中加载helper就足够了,我不必在news/index中加载它.
所以我的问题是CI下面发生了什么让我这样做?是load->查看一个函数,还是粘贴在$ data上执行新闻/索引的结果?load-> view如何识别已在索引中加载的helper url?我仍然试图理解CI框架的工作原理.
还有什么是在我们需要的时候在构造函数或每个函数中加载帮助器的最佳位置?
Also what would be the best place to load helper, in the constructor, or in each function as we need it?
作为一个粗略的经验法则;
| 归档时间: | 
 | 
| 查看次数: | 238 次 | 
| 最近记录: |