The invention discloses a locking and unlocking mechanism for a folding wing. The locking and unlocking mechanism is structurally characterized in that an inner push rod is placed in an action cylinder in the axial direction, an end cap is connected to the right end of the inner push rod in a sleeved mode, and the end face of the left end of the inner push rod is in contact with an outer push rod; a compression spring is arranged between the outer portion of the inner push rod and the inner wall of the action cylinder in a sleeved mode; two through holes for containing balls are symmetrically formed in the outer cylinder wall at the right end of the action cylinder, and the positions, corresponding to the two through holes, of an outer wing are provided with two arc grooves; when the push rod is pushed to move rightwards, the end cap is moved away from the through holes of the action cylinder, the balls are extruded into the through holes under the action of the torque of an inner wing and the outer wing and enter an inner cavity of the action cylinder, and therefore a smooth rotating shaft is formed by the action cylinder; the push rod is loosened, the inner push rod drives the end cap to move leftwards through the compression spring, the end cap moves to the through holes, the balls are ejected out of the through holes so that the arc grooves of the outer ring and the action cylinder are coaxial, the balls are ejected into the grooves, and the rotating shaft with a protrusion is formed by the action cylinder. By means of the locking and unlocking mechanism, unlocking force is reduced, the service life is prolonged, using is convenient, and occupied space is small.