【发布时间】:2016-04-19 22:35:01
【问题描述】:
所以我并不真正喜欢编码,但我试图了解一切是如何运作的。 我在 .php 文件中给出了所有内容,我想优化以下脚本,以便我可以用作图标/字体。
<?php
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
//Hier DS18B20 ID eintragen:
$temp = exec('cat /sys/bus/w1/devices/28-00000629745a/w1_slave |grep t=');
$temp = explode('t=',$temp);
$temp = $temp[1] / 1000;
$temp = round($temp,1);
echo "data: $temp° Celsius ICON_HERE \n\n";
ob_flush(); ?>
“weather-icons.css”看起来像这样:
@font-face {
font-family: 'weather';
src: url('../font/weathericons-regular-webfont.eot');
src: url('../font/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../font/weathericons-regular-webfont.woff') format('woff'), url('../font/weathericons-regular-webfont.ttf') format('truetype'), url('../font/weathericons-regular-webfont.svg#weathericons-regular-webfontRg') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="wi-"],
[class*=" wi-"] {
font-family: weather;
font-weight: normal;
font-style: normal;
text-decoration: inherit;
text-transform: none;
-webkit-font-smoothing: antialiased;
*margin-right: .3em;
}
[class^="wi-"]:before,
[class*=" wi-"]:before {
text-decoration: inherit;
display: inline-block;
speak: none;
}
.wi-day-cloudy-gusts:before {
content: "\f000";
}
我怎样才能把.wi-day-cloudy-gusts:before {content: "\f000";"}
并将其放在我的文字旁边?
你看到并明白我的问题了吗?
我可以这样做,还是朝那个方向:
<?php
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
//Hier DS18B20 ID eintragen:
$temp = exec('cat /sys/bus/w1/devices/28-00000629745a/w1_slave |grep t=');
$temp = explode('t=',$temp);
$temp = $temp[1] / 1000;
$temp = round($temp,1);
echo "data: $temp° Celsius <div content="\f000"></div> \n\n";
ob_flush();
?>
我很困惑,不知道如何将字体作为文本处理,因为它是一种样式。
【问题讨论】: