我在xampp os - windows中设置vhost时遇到了一个小问题。这是 var obj = $wilddogObject(ref); // get data from server
obj.$loaded()
.then(function(data) {
var _extends = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } }
return target; };
var moments = _.map(data, function(val, id) {
return _extends({}, val, {
id: id
});
});
$scope.ratePlaces = _.map(moments, function(place) {
// console.log(place);
if (place != null) {
if (place.like != undefined) {
function rating(like, favs) {
var parseFavs = parseInt(favs);
var parseLike = parseInt(like);
var newRate = parseLike * 0.5 + parseFavs;
return newRate;
}
place.rate = rating(place.like, place.fav_count);
}
}
return place
})
console.log($scope.ratePlaces);
list($scope.ratePlaces)
})
function list(r) {
r.shift();
r.shift();
r.shift();
r.sort((a, b) => {
if (a.rate != null || a.rate != undefined || a.rate != 'daylife' || !a.name) {
return a.rate - b.rate;
} else {}
})
r.sort((a, b) => {
if (a.rate != null || a.rate != undefined || a.rate != 'daylife' || !a.name) {
let rateA = a.rate;
let rateB = b.rate;
if (rateA < rateB) {
return -1;
}
if (rateA > rateB) {
return 1;
}
return 0;
}
});
$scope.posts = r.reverse();
httpd-vhosts.conf
C:\xampp\apache\conf\extra\httpd-vhosts.conf
位于<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/yiisite/basic/web/"
ServerName yiisite
位于hosts
C:\Windows\System32\drivers\etc\hosts
所以,当我点击我得到 127.0.0.1 yiisite
我得到我想要的,但我用来在http://yiisite
打开的htdocs中的所有其他文件夹都将找到找不到的yiisite模板404。无法使用localhost访问htdocs中的其他项目。如果我在vhosts.conf中更改端口,我可以访问localhost / abc但不能访问yiisite
答案 0 :(得分:0)
将httpd-vhosts.conf
更改为
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:/xampp/htdocs/yiisite/basic/web/"
ServerName yiisite
</VirtualHost>
解决了与htdocs内部其他项目冲突的问题,可以使用localhost/otherproject