我正试图在BigDecimal a = new BigDecimal("0.25");
a = a.setScale(3, BigDecimal.ROUND_HALF_EVEN);
的帮助下显示动态图像滑块,但是它不起作用。
我的代码:
carousel slider
我不知道自己的代码哪里错了。
答案 0 :(得分:0)
您需要检查import java.time.format.DateTimeFormatter;
import java.time._
import scala.util.parsing.combinator._
val r = "[[0_busswvan, 24.0, 2019-09-05 20:15:33],[05f9acb08d7c11e89e8fede614b72917, 20.0, 2019-09-05 14:06:32], [0_h2qbu9h3, 28.0, 2019-09-05 14:01:20],[2_busswvan, 24.0, 2019-09-05 20:15:33],[05f9acb08d7c11e89e8fede614b72917, 25.0, 2019-08-12 14:06:32], [1442qbu9h3, 28.0, 2019-09-05 14:01:20]]"
object Parser extends RegexParsers {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
def text: Parser[String] = """\w+""".r //parser for text
def number: Parser[Double] = """\d+(\.\d*)?""".r ^^ { _.toDouble } //parser for numbers
def datetime: Parser[LocalDateTime] = """\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}""".r ^^ { p => LocalDateTime.from(formatter.parse(p)) } //parser for date
def glue: Parser[String] = """\w*,\w*""".r //parser for comma separators
def term : Parser[(String, Double, LocalDateTime)] = "[" ~ text ~ ", " ~ number ~ ", " ~ datetime ~ "]" ~ opt(glue) ^^ { //parser for matching whole sublist
case _ ~ text ~ _ ~ number ~ _ ~ datetime ~ _ ~ _ => {
(text, number, datetime)
}
}
def expr : Parser[List[(String, Double, LocalDateTime)]] = "[" ~> rep(term) <~ "]" //parser for whole list containing arbitrary number of sublist
def apply(input: String): List[Any] = parseAll(expr, input) match {
case Success(result, _) => result
case failure : NoSuccess => scala.sys.error(failure.msg)
}
}
println(Parser(r))
//List((0_busswvan,24.0,2019-09-05T20:15:33), (05f9acb08d7c11e89e8fede614b72917,20.0,2019-09-05T14:06:32), (0_h2qbu9h3,28.0,2019-09-05T14:01:20), (2_busswvan,24.0,2019-09-05T20:15:33), (05f9acb08d7c11e89e8fede614b72917,25.0,2019-08-12T14:06:32), (1442qbu9h3,28.0,2019-09-05T14:01:20))
中的path
语句。
尝试替换
foreach
带有下一个代码
<img src="<?php echo base_url(); echo $img['thumbnail_url']; ?>" alt="Los Angeles" style="width:30%;">
如果它不起作用,请在<img src="<?= base_url().$img['thumbnail_url']; ?>" alt="Los Angeles" style="width:30%;">
之前加上print_r(base_url());
并查看结果。如果您可以通过将结果与foreach
配合使用来访问图像,那么您将在carusel项目中获得图像。
以相同的方式检查每个image path
的有效性($img['thumbnail_url']
必须是图像网址数组)。