×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚThinkPHP5ÖÐʹÓòî±ðĿ¼ÏµÄCSSÎļþ

thinkphp ÊÇÒ»¸ö¿ªÔ´µÄ php ¿ò¼Ü £¬ÊÇÏÖÔÚ½ÏÁ¿ÊܽӴýµÄ¿ò¼ÜÖ®Ò» £¬Ê¹ÓÃËüÄܹ»¿ìËٴ³ö¸ßЧµÄ web Ó¦ÓÃϵͳ¡£È»¶ø £¬ÔÚʹÓà thinkphp ¾ÙÐпª·¢Ê± £¬ÎÒÃÇÓÐʱ¼äÐèÒª°Ñ css Îļþ·ÅÔÚ²î±ðµÄĿ¼Àï £¬ÄÇôÔõÑùÔÚ thinkphp5 ÖÐʹÓòî±ðĿ¼Ï嵀 css ÎļþÄØ £¿

Ò»¡¢ÔÚÉèÖÃÎļþÖнç˵¾²Ì¬Îļþ·¾¶

ÔÚ ThinkPHP5 ÖÐ £¬¿ÉÒÔÔÚÉèÖÃÎļþ config.php ÖÐÕÒµ½ÏÂÃæÕâ¸ö½ç˵£º

'view_replace_str' => [
    '__PUBLIC__'=>'/public',
    '__STATIC__'=>'/static',
    '__ROOT__' => '',
],

µÇ¼ºó¸´ÖÆ

ͨ¹ýÐÞ¸Ä view_replace_str Êý×éÖеÄÖµ £¬½ç˵²î±ðĿ¼Ïµľ²Ì¬Îļþ·¾¶¡£ÆäÖÐ £¬__PUBLIC__ ½ç˵µÄÊÇÖ¸Ïò public Ŀ¼µÄ·¾¶ £¬ÕâÊÇÒ»¸öĬÈϵĹ«¹²Ä¿Â¼ £¬¿ÉÒÔ°²ÅÅ CSS¡¢JS µÈ¾²Ì¬×ÊÔ´Îļþ¡£__STATIC__ ¿ÉÒÔ½ç˵í§Ò⾲̬ÎļþĿ¼ £¬¶ø ROOT ÔòÊǽç˵ÏîÄ¿¸ù·¾¶¡£

µ±½ç˵ºÃ¾²Ì¬Îļþ·¾¶ºó £¬ÎÒÃǾͿÉÒÔÔÚÄ£°åÎļþÖÐʹÓ÷¾¶ÓÖÃû¾ÙÐÐŲÓà £¬ÈçÏÂËùʾ£º

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

<link>

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

¶þ¡¢ÔÚ¿ØÖÆÆ÷Öнç˵¾²Ì¬Îļþ·¾¶

ÔÚ¿ØÖÆÆ÷ÖÐ £¬Ò²¿ÉÒÔ½ç˵¾²Ì¬Îļþ·¾¶ £¬ÏêϸʵÏÖÒªÁìÊÇÔÚ¿ØÖÆÆ÷µÄ³õʼ»¯ÒªÁìÖнç˵ÓÖÃû £¬´úÂëÈçÏ£º

public function _initialize() {
    parent::_initialize();
    $this-&gt;assign('public', '/public');
    $this-&gt;assign('custom', '/custom'); // ×Ô½ç˵Ŀ¼
}

µÇ¼ºó¸´ÖÆ

ÕâÀï½ç˵ÁË PUBLIC ºÍ CUSTOM Á½¸öÌåÃû £¬²¢°Ñ¶ÔӦ·¾¶×ª´ï¸øÁËÇ°¶ËÊÓͼ¡£ÔÚÄ£°åÖÐŲÓþ²Ì¬Îļþʱ £¬¾Í¿ÉÒÔʹÓÃÕâЩÓÖÃû £¬ÀýÈ磺

<link><link>

µÇ¼ºó¸´ÖÆ

ÈôÊÇÐèÒªÔÚ²î±ðµÄ¿ØÖÆÆ÷Öнç˵²î±ðµÄ¾²Ì¬Îļþ·¾¶ £¬¿ÉÒÔÔÚÿ¸ö¿ØÖÆÆ÷Öе¥¶À½ç˵¡£

Èý¡¢Ê¹Óö¯Ì¬·½·¨¾ÙÐз¾¶ÉèÖÃ

³ýÁËÔÚÉèÖÃÎļþÖкͿØÖÆÆ÷Öнç˵·¾¶Íâ £¬»¹¿ÉÒÔÔÚÄ£°åÎļþÖÐʹÓö¯Ì¬·½·¨¾ÙÐз¾¶ÉèÖá£ÏêϸҪÁìÊÇÔÚÄ£°åÖÐʹÓà ThinkPHP ÌṩµÄ asset() ÒªÁì £¬´«ÈëÏà¶Ô·¾¶¼´¿É £¬ÀýÈ磺

<link>

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÕâÑù £¬Ä£°åÎļþ¾Í»á×Ô¶¯Æ¾Ö¤ÉèÖÃÌìÉú¶ÔÓ¦µÄ¾²Ì¬Îļþ·¾¶¡£ËäÈ» £¬ÕâÖÖ·½·¨Ö»ÊÊÓÃÓÚÇ°¶Ë¿ª·¢Õ߶ԿØÖÆÆ÷¼°ÉèÖÃÎļþ²»¿É¼ûµÄ³¡ºÏ¡£

×ܽá

ÒÔÉϾÍÊÇÔÚ ThinkPHP5 ÖÐʹÓòî±ðĿ¼Ï嵀 CSS ÎļþµÄÒªÁì £¬ÆñÂÛÊÇÔÚÉèÖÃÎļþ¡¢¿ØÖÆÆ÷ÖÐÕվɶ¯Ì¬·½·¨ÖÐ £¬¶¼¿ÉÒÔʵÏÖ·¾¶ÓÖÃûµÄ½ç˵ £¬ÈÃÎÒÃÇÔ½·¢Àû±ãµØÖÎÀí¾²Ì¬×ÊÔ´Îļþ¡£

ÒÔÉϾÍÊÇÔõÑùÔÚThinkPHP5ÖÐʹÓòî±ðĿ¼ÏµÄCSSÎļþµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ