This article presents a prescribed-time output feedback control (PTOFC) algorithm for cyber-physical systems (CPSs) under output constraint occurring in any finite time interval (OC-AFT) and malicious attacks. The OC-AFT meaning that the output constraint only occurs during a finite number of time periods while being absent in others, which is more general and complex than traditional infinite-time/deferred output constraints. A stretch model-based nonlinear mapping function is constructed to handle the OC-AFT, and a salient advantage is that the proposed algorithm is also suit for CPSs with infinite-time/deferred output (or funnel) constraints, as well as those that are constraint-free, without necessitating changes to the control structure. The uncertain terms (including system model uncertainties, malicious attacks, and external disturbances) are compensated by fuzzy logic systems. Furthermore, a novel practical prescribed-time stability criterion is proposed, under which a novel PTOFC scheme is given. The results demonstrate that the proposed scheme can ensure that both tracking error and observation error converge to a neighborhood centered on zero within a prescribed time, while accommodating the OC-AFT and malicious attacks. Additionally, the settling time remains unaffected by control parameters and initial states, and the limitations of excessive initial control inputs and singularity problems in existing prescribed-time control algorithms are eliminated. The developed algorithm is exemplified through simulation instances.