我正在使用Magento模板,其中包含以下代码:
<link rel="stylesheet" id="emcssvariation" type="text/css" media="all" href="<?php echo $this->getSkinUrl('css/theme.css.php').'?'.http_build_query($setting->getAllCssConfig(), '', '&'); ?>"/>
目前的结果是:
http://myshop.com/home/skin/frontend/default/galarainbow/css/theme.css.php?p_bg_color=%23ffffff&page_bg_image=url%28..%2Fimages%2Fstripes%2Fblank.gif%29&page_bg_position=&page_bg_repeat=&general_font=&h1_font=300+38px%2F1.15+%27Lato%27%2C+sans-serif&h2_font=600+22px%2F1.25+%27Lato%27%2C+sans-serif&h3_font=600+18px%2F1.25+%27Lato%27%2C+sans-serif&h4_font=600+16px%2F1.35++%27Lato%27%2C+sans-serif&h5_font=500+14px%2F1.35+%27Lato%27%2C+sans-serif&h6_font=normal+12px%2F1.35+%27Lato%27%2C+sans-serif&additional_css_file=custom.css&custom_css=&h_text_color=%23595958&h_text2_color=%230f6338&h_text3_color=&h_line_color=&h_line2_color=%238CC63F&h_line3_color=&h_bg_color=&h_bg2_color=&h_bg3_color=&h_bg_image=url%28..%2Fimages%2Fstripes%2Fblank.gif%29&h_bg_position=&h_bg_repeat=&tm_bg_color=%238cc63f&tm_hover_bg_color=%230f6338&tm_text_color=&tm_hover_text_color=&tm_line_color=%23fff&tm_line2_color=%23fff&tm_font=normal+13px%2F1.35+%27Lato%27%2C+sans-serif&dm_bg_color=%23ffffff&dm_text_color=%23424242&dm_text2_color=%23424242&dm_text3_color=%230f6338&dm_font=normal+15px%2F1.35+%27Lato%27%2C+sans-serif&bd_bg_color=&bd_bg_image=url%28..%2Fimages%2Fstripes%2Fblank.gif%29&bd_bg_position=&bd_bg_repeat=&bd_bg2_color=%238cc63f&bd_bg3_color=&bd_bg4_color=%230f6338&bd_text_color=&bd_text2_color=&bd_text3_color=&bd_text4_color=%230F6338&bd_text5_color=&bd_text6_color=%230F6338&bd_text7_color=%23ffffff&bd_line_color=&bd_line2_color=&bd_box_shadow=&bd_rounded_corner=5&f_bg_color=%231b1b1b&f_bg_image=url%28..%2Fimages%2Fstripes%2Fblank.gif%29&f_bg_position=&f_bg_repeat=&f_bg2_color=%23282828&f_text_color=%23aaaaaa&f_text2_color=%23ffffff&f_text3_color=+%23ffffff&f_text4_color=&f_line_color=%23282828&f_line2_color=&btn1_bg_color=%23000000&btn1_text_color=&btn1_line_color=&btn1_font=300+16px%2F1.35+%27Lato%27%2C+sans-serif&btn2_bg_color=%238CC63F&btn2_text_color=&btn2_line_color=%230F6338&btn2_font=300+16px%2F1.35+%27Lato%27%2C+sans-serif&btn3_bg_color=%230F6338&btn3_text_color=&btn3_line_color=%230F6338&btn3_font=300+16px%2F1.35+%27Lato%27%2C+sans-serif
然而,理想情况下,由于这会导致我们的CDN出现问题,我想使用硬编码的URL而不是getskinURL。解决这个问题的最佳方法是什么?
答案 0 :(得分:1)
请注意,硬编码网址绝不是一个好方法。使用getSkinUrl的Magento方式是最好的方法。但是,您想要实现的目标可以通过以下方式实现:
$ cssURL = $ _SERVER [&#39; SERVER_NAME&#39;]。 &#39;家/皮肤/前端/默认/ galarainbow / CSS / theme.css.php&#39 ;;
希望这会有所帮助!!