The present invention relates to an N-substituted-phenyl-5-substituted-alkoxy-2,3-dihydro-[1,4]dioxane[2,3-f]quinazolin-10-amine (I) or 4-substituted-arylamino-6-substituted-alkyl-6H-[1,4]oxazino[3,2-g]quinazoline-7(8H)-one (II) type compounds, a preparation method thereof and an application thereof as an inhibitor for epidermal growth factor receptor (EGFR) (comprising some mutant forms of EGFR) to treat cancer. These compounds and salts thereof can be used to treat or prevent various cancer diseases.