Question: how did ezra know alison?
Answer: After Aria finds out the truth about Ezra, Ezra explains that he knew who she was when they first met. They main reason he started a relationship with her was to gain information about Alison because he was writing a book about her, a "true crime novel".