In existing research on nested named entity recognition, span-based methods are employed to treat named entity recognition problems as span classification tasks, wherein finetuned pretrained models are utilized to facilitate more efficient recognition of nested entities. However, issues such as domain knowledge deficiency and failure to realize multi-classification are still unsolved. To address these issues, this paper innovatively put forward a Multi-Head Model Based on Knowledge Embedding (MKE), which: (1) introduces domain-specific background knowledge in the form of entity matrices, allowing the background knowledge to be embedded without any loss, and (2) transforms named entity recognition into a multi-head selection process, followed by scoring the candidate spans using the attention score model. This method realizes entity multi-classification, while also ensuring accurate identification of nested entity boundaries. The experimental results show that the background knowledge embedding realized by the entity matrix method is able to not only elevate the recognition accuracy, but also achieve the state-of-theart performance on seven nested and flat named entity recognition datasets.