<p><font size="4">CodeIgniter中加载css文件</font></p> <p><font size="4">1.用原始的html中的link标签 <br />2<strong>.用CodeIgniter内建的link_tag函数</strong></font></p> <p> <br /><font size="4"><strong>STEP1---载入ci的html helper <br /></strong>   a.在对应的控制器中添加代码:<strong>$this->load->helper('html'); </strong> <br />   b.在config/autoload.php文件中,<strong>修改$autoload['helper'] = array('html');</strong>这样CI会自动加载html助手。</font></p> <p> <br /><strong><font size="4">STEP2---使用</font></strong></p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:7b30ab2d-0e0d-435d-a7a0-e1c6dcc616d3" class="wlWriterEditableSmartContent"><pre class="brush: php; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 312px; height: 16px;" style=" width: 312px; height: 16px;overflow: auto;">echo link_tag('css/mystyles.css') </pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div>
<p><font size="4">它会输出</font></p>
<p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:8433f20d-e8e7-4866-9e38-7c9f3983a5b5" class="wlWriterEditableSmartContent"><pre class="brush: xml; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 668px; height: 22px;" style=" width: 668px; height: 22px;overflow: auto;"><link href="http://site.com/css/mystyles.css" rel="stylesheet" type="text/css" /></pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div> </p>
<p><font size="4">复杂的使用: <br /></font>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:ff9384c4-9865-46ac-bc14-48dc1cf05386" class="wlWriterEditableSmartContent"><pre class="brush: php; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 312px; height: 113px;" style=" width: 312px; height: 113px;overflow: auto;"> $link = array( 'href' => 'css/printer.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'print'); echo link_tag($link);</pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div>
<br /><font size="4">等效于</font></p>
<p><font size="4"> </font>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:273d1530-4fe0-4cbf-8b17-3027d49c9908" class="wlWriterEditableSmartContent"><pre class="brush: xml; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 781px; height: 38px;" style=" width: 781px; height: 38px;overflow: auto;"><link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" /> </pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div> </p>
<p><font size="4"></font></p>
<p><font size="4"></font></p>
<p><font size="4"></font></p>
<p><font size="4"></font></p>