本文整理汇总了PHP中Map::addLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::addLocation方法的具体用法?PHP Map::addLocation怎么用?PHP Map::addLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::addLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Map
<!DOCTYPE html>
<html>
<head>
<title>Map Tests</title>
</head>
<body>
<h1>Map Tests</h1>
<?php
include_once "../includer.php";
$map = new Map(null);
echo "Map ID: " . $map->getMapID();
echo "<hr/>";
echo "<h3>Should add three locations to map and print</h3>";
$map->addLocation("New York");
$map->addLocation("London");
$map->addLocation("Rome");
foreach ($map->getLocations() as $location) {
echo "<h4>{$location}</h4>";
}
echo "<hr/>";
echo "<h3>Should remove last location and print remaining</h3>";
$map->removeLastLocation();
foreach ($map->getLocations() as $location) {
echo "<h4>{$location}</h4>";
}
echo "<hr/>";
?>
</body>
</html>
示例2: Map
<!DOCTYPE html>
<html>
<head>
<title>MapView Tests</title>
</head>
<body>
<h1>MapView Tests</h1>
<h3>Should call MapView::show()</h3>
<hr/>
<?php
include_once "../includer.php";
$map = new Map(null);
$map->addLocation("Rome");
MapView::show($map->getLocations());
?>
</body>
</html>
示例3: connectDB
<?php
header('Access-Control-Allow-Origin: http://localhost:63342/alertt_app/map.html');
class Map
{
public function connectDB($sql)
{
$conn = new mysqli("localhost", "root", "root", "alertt_db");
$conn->query($sql);
$conn->close();
}
public function addLocation()
{
$hazard = filter_input(INPUT_POST, 'hazard');
$comment = filter_input(INPUT_POST, 'comment');
$lat = filter_input(INPUT_POST, 'lat');
$lng = filter_input(INPUT_POST, 'lng');
$SQL = 'INSERT INTO hazards_tb (hazard, comment,lat,lng) VALUES ("' . $hazard . '","' . $comment . '","' . $lat . '","' . $lng . '")';
$this->connectDB($SQL);
}
}
$map = new Map();
echo $map->addLocation();