我需要在样式表中插入一些PHP代码 [英] I need insert some PHP code in style sheet

查看:102
本文介绍了我需要在样式表中插入一些PHP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的css

  div.image {
width:<?php echo get_image_size($ size [ 1]); > px;
}

大小存储在数组中,因此我称为$ size [1]这里...



我是php的初学者...



任何一个pls帮助?

解决方案

为了你需要使用这样


  1. 将css文件更改为css.php,并使用类似这样的样式表



    < link rel =stylesheet =text / csshref =css.php?opt1 =<?php echo get_image_size($ size [1]);?& />



    <$> c $ c> div.image {
    width:<?php echo $ _GET ['opt1']; > px;
    }


请尝试此


In my css

div.image {
   width:<?php echo get_image_size( $size[1] ); ?>px;
}

The size is stored in an array so i called $size[1] to here...

I am beginner in php...

any one pls help?

解决方案

For that you need to use like this

  1. change your css file as css.php, and use stylesheet include like this

    <link rel="stylesheet" type="text/css" href="css.php?opt1=<?php echo get_image_size($size[1] ); ?>" />

  2. In css.php file

    div.image { width:<?php echo $_GET['opt1']; ?>px; }

try this

这篇关于我需要在样式表中插入一些PHP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆