-5
我在地图上添加了一个搜索栏,它工作正常,但是当我开始会话时,发生了一些事情,突然它停止工作。当我删除会话,它的工作原理,但会议它不起作用。 有人吗?搜索栏不工作后session_start()
我的PHP代码
<?php session_start();
if(isset($_SESSION['username']) && $_SESSION['username']!="")
{
?>
<input type="text" value="" id="searchbox">
<?php
}
else
{
//echo "You are not supposed to be here. Please <a href='login.php'>login</a> first.";
header("Location:login.php");
}
?>
代码:
$(function() {
$("#searchbox").autocomplete({
source: function(request, response) {
if (geocoder == null) {
geocoder = new google.maps.Geocoder();
}
geocoder.geocode({
'address': request.term
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var searchLoc = results[0].geometry.location;
var lat = results[0].geometry.location.lat();
var lng = results[0].geometry.location.lng();
var latlng = new google.maps.LatLng(lat, lng);
var bounds = results[0].geometry.bounds;
geocoder.geocode({
'latLng': latlng
}, function(results1, status1) {
if (status1 == google.maps.GeocoderStatus.OK) {
if (results1[1]) {
response($.map(results1, function(loc) {
return {
label: loc.formatted_address,
value: loc.formatted_address,
bounds: loc.geometry.bounds
}
}));
}
}
});
}
});
},
select: function(event, ui) {
var pos = ui.item.position;
var lct = ui.item.locType;
var bounds = ui.item.bounds;
if (bounds) {
map.fitBounds(bounds);
}
}
});
});
看看html页面的来源。它看起来像PHP生成一个错误'头被以前发送......'这使您的HTML代码无效。 – Cheery 2014-10-08 04:56:53
这是html代码: -
– 2014-10-08 05:06:45
伙计,PHP代码导致错误,你给我们HTML :) – 2014-10-08 05:07:46