好吧,这就是我要做的,我想逃避句号,这样我就可以在我的代码中添加 .8em 字体和 2.5em 字体,而不是普通的数字字体。我尝试在这个脚本中以三种不同的方式转义句点,但我认为我做错了。
这是我在脚本中的字体大小。
$min_size = 1; //change to .8
$max_size = 2; //change to 2.5
这是显示字体大小的脚本的一部分。
$tags = tag_info();
$minimum_count = min(array_values($tags));
$maximum_count = max(array_values($tags));
$spread = $maximum_count - $minimum_count;
if($spread == 0) {
$spread = 1;
}
$cloud_html = '';
$cloud_tags = array();
foreach ($tags as $tag => $count) {
$size = $min_size + ($count - $minimum_count)
* ($max_size - $min_size) / $spread;
$cloud_tags[] = '<a style="font-size: '. floor($size) . 'em'
. '" class="tag_cloud" href="http://www.example.com/tags/' . $tag .'/'
. '" title="\'' . $tag . '\' returned a count of ' . $count . '">'
. htmlspecialchars(stripslashes($tag)) . '</a>';
}
$cloud_html = join("\n", $cloud_tags) . "\n";
return $cloud_html;
}
最佳答案
floor($size)
将使 $size
的值 2.5
变为 2
和 0.8
到 0
。你为什么要使用floor
?
关于php - 如何转义 php 和 mysql 问题的句点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1851713/