大家好我想在$ _SESSION []变量中放一个数组,但是当我尝试运行代码时会触发这个:
注意:未定义的偏移量:1
这是我的代码
angular.module('myplaces')
.component('placespage', {
templateUrl: 'places.template.html',
controller: controller
})
function controller(placeService, NgMap) {
const ctrl = this;
ctrl.locations = [];
ctrl.marker = []
ctrl.map = {}
var map;
ctrl.$onInit = function() {
placeService.getPlaces().then(function(response) {
console.log(response.data.rows);
ctrl.locations = response.data.rows;
})
NgMap.getMap().then(function(map) {
console.log(ctrl.map);
})
ctrl.map = {
center:
{
latitude: 34.8394,
longitude: 134.6939
},
zoom:5,
};
}
ctrl.pinClicked = function(loc) {
console.log(loc); //This is getting nothing...
ctrl.map.setZoom(8);
}
我试图更改指向列的数字的位置,例如 echo $ _SESSION [1] [' st_id'];但我得到同样的错误
当我将行放在普通数组中时,例如:
$stmt1=$conn->prepare('SELECT st_id FROM stores WHERE user_id= :user_id');
$stmt1->bindParam(':user_id', $_SESSION['user_id'], PDO::PARAM_INT);
$stmt1->execute();
$numofst=$stmt1->fetchAll(PDO::FETCH_ASSOC);
foreach ($numofst as $row){
$_SESSION['st_id']= $row;
}
echo $_SESSION['st_id'][1];
一切正常,没有问题
我错过了什么?
提前致谢
vaggelis