2014-10-31 32 views
0

正如标题所暗示的,我如何将HTML :: style链接到单独的静态文件服务器? laravel中是否有全局配置文件?如何将HTML :: style链接到laravel中的独立静态文件服务器?

+0

这没有配置选项,但你可以编辑我确定的方法。 – 2014-10-31 18:38:14

+0

不!不要只编辑该方法。它属于Laravel核心,不应该改变!您应该扩展HTML Facade或创建您自己的Helper类 – lukasgeiter 2014-10-31 19:53:30

回答

-1

这可能不是最好的解决方案,但它应该工作。以下方法取自Illuminate\Html\HtmlBuilder.php

方法名称为style,它返回一个链接。在该方法中,您可以将$attributes['href']更改为您的URL并连接资产的URI。

public function style($url, $attributes = array(), $secure = null) 
{ 
    $defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'); 

    $attributes = $attributes + $defaults; 

    $attributes['href'] = $this->url->asset($url, $secure); 

    return '<link'.$this->attributes($attributes).'>'.PHP_EOL; 
} 

查看官方API文档。这里:http://laravel.com/api/4.1/Illuminate/Html/HtmlBuilder.html#method_style

相关问题