thinkphp¼ÓÔصÄcss·¾¶²î³ØÔõô°ì
ÔÚʹÓà thinkphp ¿ò¼Ü¾ÙÐпª·¢µÄÀú³ÌÖУ¬ÓÐʱ»áÓöµ½¼ÓÔØµÄ css Îļþ·¾¶²»×¼È·µÄÎÊÌ⣬´Ó¶øµ¼ÖÂÑùʽÎļþÎÞ·¨Õý³£¼ÓÔØ£¬Ó°ÏìÒ³ÃæÑŹ۶ȣ¬ÉõÖÁµ¼ÖÂһЩ¹¦Ð§ÎÞ·¨Ê¹Óᣱ¾ÎĽ«ÏÈÈݵ¼Ö css Îļþ·¾¶²»×¼È·µÄ¿ÉÄÜÔµ¹ÊÔÓÉ£¬ÒÔ¼°ÔõÑù½â¾öÕâЩÎÊÌâ¡£
Ö¸¶¨ CSS ÎļþµÄ·¾¶²»×¼È·
Ê×ÏÈÒª¼ì²éµÄÊÇ CSS ÎļþµÄ·¾¶ÊÇ·ñ׼ȷ¡£ÔÚһЩÇéÐÎÏ£¬ÎÒÃÇÐèÒªÊÖ¶¯Ö¸¶¨ CSS ÎļþµÄ·¾¶£¬ÈôÊÇ·¾¶²»×¼È·£¬ÄÇôä¯ÀÀÆ÷¾ÍÎÞ·¨ÕÒµ½ CSS Îļþ²¢¼ÓÔØ£¬´Ó¶øµ¼ÖÂÑùʽÎļþÎÞ·¨Õý³£Ê¹Óá£
ÎÒÃǽ¨ÒéʹÓÃÏà¶Ô·¾¶£¬Ö¸¶¨Ïà¹ØÓÚÄ¿½ñÒ³ÃæµÄ CSS Îļþ·¾¶¡£ÈôÊÇÄãʹÓÃÁ˾ø¶Ô·¾¶£¬ÄÇôÇë¼ì²éÖ¸¶¨µÄ·¾¶ÊÇ·ñ׼ȷ£¬²»¿ÉʹÓÃÍâµØ·¾¶£¬Ó¦¸ÃʹÓà URL µØµã¡£
Thinkphp ĬÈϵÄÎļþ·¾¶ÓÐÎó
ÈôÊÇÄãʹÓà thinkphp ¿ò¼Ü¿ª·¢£¬ÓпÉÄÜÊÇÓÉÓÚ thinkphp ĬÈϵÄÄ£°å·¾¶Ê¹Óò»µ±µ¼Ö£¬Îª½â¾ö´ËÎÊÌ⣬ÎÒÃÇ¿ÉÒÔÔÚ¿ØÖÆÆ÷ÖмÓÈ룺
$this->view->engine->layout(true);
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
´úÂ뽫ĬÈϵÄÄ£°å·¾¶¸ü¸ÄΪĿ½ñµÄÄ£°åĿ¼¡£È»ºóÔÚÄ£°åÖмÓÔØÑùʽ±íʱ£¬Ó¦¸ÃʹÓÃÏà¹ØÓÚÄ¿½ñÄ£°åĿ¼µÄ·¾¶¡£
Apache ÉèÖÃÎÊÌâ
ÈôÊÇÄãµÄ Web ЧÀÍÆ÷ʹÓà Apache£¬ÓÐʱ CSS Îļþ·¾¶µÄÎÊÌâÒ²ÓпÉÄÜÔ´×Ô Apache µÄÉèÖÃÎÊÌâ¡£ÔÚһЩÇéÐÎÏ£¬Apache »áʹÓà rewrite Ä£¿éÀ´ÖØд URL£¬´Ó¶øÓ°Ïì CSS ÎļþµÄ·¾¶¡£Õâʱ¼ä£¬ÎÒÃÇ¿ÉÒÔÔÚ Apache µÄÉèÖÃÎļþÖмÓÈëÈçϲÎÊý¾ÙÐÐÉèÖãº
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Õ⽫µ¼ÖÂËùÓеÄÇëÇó¶¼×ª·¢¸ø index.php Îļþ¾ÙÐд¦Àí£¬´Ó¶øÈ·±£ CSS Îļþ·¾¶¾ø¶Ô׼ȷ¡£
·ÓÉÎÊÌâ
×îºó£¬ÎÒÃÇ»¹ÐèҪעÖØ·ÓÉÎÊÌâ¡£ÔÚһЩÇéÐÎÏ£¬ÎÒÃÇ»áʹÓ÷Óɹ¦Ð§À´»á¼û¿ØÖÆÆ÷ÖеÄÒªÁ죬²¢ÇÒÔÚ·ÓÉÉèÖÃÖÐʹÓÃÁËÕýÔò±í´ïʽ¡£Õâʱ¼ä¾ÍÐèÒª×Ðϸ¼ì²é·ÓÉÉèÖÃÖеÄÕýÔò±í´ïʽÊÇ·ñ׼ȷÁË¡£ÈôÊÇ·ÓÉÉèÖÃÓÐÎ󣬽«»áµ¼Ö CSS ·¾¶·ºÆðÎÊÌâ¡£
×ܽá
ÔÚ¿ª·¢Àú³ÌÖУ¬ÈôÊÇ CSS Îļþ·¾¶·ºÆðÎÊÌ⣬¿ÉÄܻᵼÖÂÒ³ÃæÑùʽÎÞ·¨Õý³£ÏÔʾ¡£Í¨¹ý±¾ÎĵÄÏÈÈÝ£¬ÎÒÃÇÏ£Íû¿ÉÒÔ×ÊÖúµ½¸÷ÈË£¬Èø÷ÈËѧ»áÔõÑù½â¾ö CSS Îļþ·¾¶ÎÊÌâ¡£½¨Òé¸÷ÈËÔÚ¿ª·¢Àú³ÌÖУ¬ÈÏÕæ¼ì²éÎļþ·¾¶£¬²¢ÇÒºÏÀíʹÓ÷Óɹ¦Ð§ºÍ Apache ÉèÖù¦Ð§£¬×èÖ¹·ºÆð CSS Îļþ·¾¶ÎÊÌâ¡£
ÒÔÉϾÍÊÇthinkphp¼ÓÔصÄcss·¾¶²î³ØÔõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡