如何解决子文件夹中的FuelPHP资产
| 是否可以使用Assets包含子文件夹中的文件? 例: [base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css解决方法
您可以使用以下方法访问资产/文件夹的子文件夹:
// Image in /assets/img1.jpg
print Asset::img(\"img1.png\");
// Image in /assets/subfolder/img2.jpg
print Asset::img(\"subfolder/img2.jpg\");
, 在./fuel/core/config/asset.php
中,您可以更改以下代码:
/**
* An array of paths that will be searched for assets. Each asset is a
* RELATIVE path from the base_url WITH a trailing slash:
*
* array(\'assets/\')
*/
\'paths\' => array(\'\'),
和
/**
* Asset Sub-folders
*
* Names for the img,js and css folders (inside the asset path).
*
* Examples:
*
* img/
* js/
* css/
*
* This MUST include the trailing slash (\'/\')
*/
\'img_dir\' => \'img/\',\'js_dir\' => \'js/\',\'css_dir\' => \'css/\'
如果将paths
配置为assets
,并将css_dir
配置为css/
,则可以通过使用ѭ9include将[base_url] /assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css
包括在内。
, 是的,您只需将asset.php中的路径设置为您喜欢的任何路径:
$config[\'asset_paths\'] = array(\'assets/\');
也就是说,如果您想使用资产库。否则,仅使它们成为来自webroot的绝对路径。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。