我有一个网站,我想确定地理软件的用户输入,并使用该地址,如会议.
问题是谷歌自动完成还会显示"仅限邮政编码"或没有街道号的街道.
无论如何在显示之前过滤自动完成结果?
var input = /** @type {HTMLInputElement} */(
document.getElementById('pac-input'));
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(52.66805480068766, 13.7713623046875),
new google.maps.LatLng(52.32191088594773, 12.98858642578125));
var autocomplete_options = {
bounds: defaultBounds,
componentRestrictions: {country: 'de'},
types: ['geocode']
};
autocomplete = new google.maps.places.Autocomplete(input, autocomplete_options);
google.maps.event.addListener(autocomplete, 'place_changed', callServer);
Run Code Online (Sandbox Code Playgroud)
我的测试站点可以在这里找到自动完成:http: //www.winterreifenwechsel.de/welcome/termine
尝试一些输入,如14169(邮政编码)或Wilskistr(没有房子的街道).
我使用webgrind和xdebug来破坏我的网站性能.函数php :: PDO - > __ construct(约1秒)采用85%的页面加载时间...
这是无法接受的.我能以某种方式优化这个功能吗?(缓存,mysql配置等)
我正在使用php,mysql和codeigniter与redbean.redbean使用那个pdo构造函数...
这是函数源代码
/**
* Establishes a connection to the database using PHP PDO
* functionality. If a connection has already been established this
* method will simply return directly. This method also turns on
* UTF8 for the database and PDO-ERRMODE-EXCEPTION as well as
* PDO-FETCH-ASSOC.
*
* @return void
*/
public function connect() {
if ($this->isConnected) return;
$user = $this->connectInfo['user'];
$pass = $this->connectInfo['pass'];
//PDO::MYSQL_ATTR_INIT_COMMAND
$this->pdo = new PDO(
$this->dsn,
$user,
$pass, …Run Code Online (Sandbox Code Playgroud)