An electronic device, comprising: a card holder, a card tray, a processing chip, and an unlocking structure, wherein a slot that accommodates the card tray is disposed on the card holder, and at least one locking structure is disposed in the slot; the unlocking structure comprises an electromagnet, the unlocking structure is connected to the processing chip, the card tray is configured to accommodate a card of the electronic device, and at least one locking part that fits the locking structure is disposed on the card tray; and the processing chip is configured to: when a card removal operation signal is received, verify a user identity, and when the user identity verification succeeds, control the unlocking structure to release the card tray, wherein the user identity verification is implemented by using any one or combination of a password, a fingerprint, an iris, voice, or appearance, wherein: the unlocking structure further comprises a first pull lever, a first shift lever, a spring, and a mounting hole; a first end of the spring is fastened in the mounting hole, and a second end of the spring is connected to a first end of the first pull lever; a second end of the first pull lever is hinged to the first shift lever, and the first shift lever is fastened on the card holder through a first shaft; a magnetic component is fastened on a position that is on the first pull lever and opposite to the electromagnet; and the controlling the unlocking structure to release the card tray comprises: changing a power status of the electromagnet, so that a magnetic attraction force from the electromagnet to the magnetic component is less than a resilience force of the spring, the first pull lever moves towards the bottom of the slot under an effect of the resilience force of the spring, the first shift lever is driven by the first pull lever to rotate around the first shaft, and the card tray is ejected under pushing of the first shift lever. a card holder, a card tray, a processing chip, and an unlocking structure, wherein a slot that accommodates the card tray is disposed on the card holder, and at least one locking structure is disposed in the slot; the unlocking structure comprises an electromagnet, the unlocking structure is connected to the processing chip, the card tray is configured to accommodate a card of the electronic device, and at least one locking part that fits the locking structure is disposed on the card tray; and the processing chip is configured to: when a card removal operation signal is received, verify a user identity, and when the user identity verification succeeds, control the unlocking structure to release the card tray, wherein the user identity verification is implemented by using any one or combination of a password, a fingerprint, an iris, voice, or appearance, wherein: the unlocking structure further comprises a first pull lever, a first shift lever, a spring, and a mounting hole; a first end of the spring is fastened in the mounting hole, and a second end of the spring is connected to a first end of the first pull lever; a second end of the first pull lever is hinged to the first shift lever, and the first shift lever is fastened on the card holder through a first shaft; a magnetic component is fastened on a position that is on the first pull lever and opposite to the electromagnet; and the controlling the unlocking structure to release the card tray comprises: changing a power status of the electromagnet, so that a magnetic attraction force from the electromagnet to the magnetic component is less than a resilience force of the spring, the first pull lever moves towards the bottom of the slot under an effect of the resilience force of the spring, the first shift lever is driven by the first pull lever to rotate around the first shaft, and the card tray is ejected under pushing of the first shift lever. the unlocking structure further comprises a first pull lever, a first shift lever, a spring, and a mounting hole; a first end of the spring is fastened in the mounting hole, and a second end of the spring is connected to a first end of the first pull lever; a second end of the first pull lever is hinged to the first shift lever, and the first shift lever is fastened on the card holder through a first shaft; a magnetic component is fastened on a position that is on the first pull lever and opposite to the electromagnet; and the controlling the unlocking structure to release the card tray comprises: changing a power status of the electromagnet, so that a magnetic attraction force from the electromagnet to the magnetic component is less than a resilience force of the spring, the first pull lever moves towards the bottom of the slot under an effect of the resilience force of the spring, the first shift lever is driven by the first pull lever to rotate around the first shaft, and the card tray is ejected under pushing of the first shift lever.