Beer will do the same thing or vinegar. Pour some in a glass put plastic wrap over the top and a take a pencil and poke a small hole making a funnel They can get in but not out. you could also do the same with an old seasoning container. I think I would rather not attract them into the house in the first place though. We re-screened our screens with no-see-um size grid. This made the most difference. I don't like to leave fruit out at all although I think my husband thinks I'm nuts

Also clean garbage disposer, drains, overflow drains and under the rim of toilet often. phorid flies love those areas.