当我使用 carabiner 库时,我的 css 和 js 文件附加到页面顶部。有没有一种方法可以指定文件应该附加到哪里,或者尝试将文件作为数组发送到我的 View 文件?
谢谢
最佳答案
根据您呈现观点的方式可能会略有不同,但使用传统的、乏善可陈的方式,这里有一个例子:
家庭 Controller :
public function index()
{
$this->carabiner->css('default.css')
$this->carabiner->js('custom.js');
$data['assets'] = $this->carabiner->display_string('both');
$this->load->view('templates/header', $data);
$this->load->view('home/index', $data);
$this->load->view('templates/footer');
}
标题 View :
<html>
<head>
<title>Title of Page</title>
<?php echo $assets; ?>
</head>
...
关于php - 登山扣问题 -- Codeigniter 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5926295/