Disclosed are an aromatic acetylene or aromatic ethylene compound, an intermediate, a preparation method, a pharmaceutical composition and a use thereof. The aromatic acetylene or aromatic ethylene compound has a significant inhibitory effect on PD-1 and PD-L1, and can effectively relieve or treat cancers and other related diseases.