我有一个存储在mysql数据库中的卫星图像.该表具有纬度,经度属性.我想将它们发送到树枝并显示为地图,我的php控制器看起来像这样.
public function highlightAction()
{
$highlighted=$this->getDoctrine()
->getRepository('AppBundle:satelliteImage')
->findAll();
$images = array();
foreach ($highlighted as $key => $high) {
$images[$key] = base64_encode(stream_get_contents($high->getImage()));
}
return $this->render('satelliteImages/highlighted.html.twig',array(
'highlighted' => $highlighted,
'images' => $images
));
}
我的枝条代码是这样的:
{% for key,high in highlighted %}
{% endfor %}
我将图像显示为垂直阵列.任何建议,我可能需要将它们显示为地图.
树枝上的二维数组?
解决方法:
你可以使用这样的东西:
{% for key in 0..2 %}
{% for key in 0..3 %}
{% endfor %}
{% endfor %}
标签:php,arrays,mysql,twig,symfony
来源: https://codeday.me/bug/20190627/1308648.html