\int \frac{d^3 {\bf k}}{(2 \pi)^{3}} \phi^*_{\bf k} (t)  e^{-i {\bf k} \cdot {\bf x}}, \label{fourier}\end{aligned}$$ and obtain the time-dependent Hamiltonian $$\begin{aligned}
H(t) = \int \frac{d^3 {\bf k}}{(2 \pi)^{3}} \Bigl[ \pi_{\bf k}^{*} \pi_{\bf k} + \omega_{\bf k}^2 (t) \phi_{\bf k}^{*} \phi_{\bf k} \Bigr], \label{E-ham}\end{aligned}$$ where $\pi_{\bf k} = \dot{\phi}^*_{\bf k}$ and $\pi_{\bf k}^* = \dot{\phi}_{\bf k}$ are canonical momenta, and the time-dependent frequencies are $$\begin{aligned}
\omega_{\bf k}^2 (t) = (k_{\parallel} - q A_{\parallel} (t))^2 + {\bf k}_{\perp}^2 + m^2.\end{aligned}$$ The classical Heisenberg equation $$\begin{aligned}
 \ddot{\phi}_{\bf k} (t) + \omega_{\bf k}^2 (t) \phi_{\bf k} (t) =0, \label{E-eq}\end{aligned}$$ is the corresponding Fourier mode of the KG equation, which explains the equivalence between the quantum invariant method in this paper and the conventional canonical quantum field theory. As mentioned in Introduction, the quantum invariant method has the merit of diversity of quantum states.

Secondly, in the case of homogeneous, time-dependent magnetic fields along the $z$-direction, after Fourier-decomposing the fields along the longitudinal direction, we find the Lagrangian $$\begin{aligned}
L(t) = \int d^2 {\bf x}_{\perp} \Bigl[ \dot{\phi}^{*}_{k_z} ({\bf x}_{\perp}) \dot{\phi}_{k_z} ({\bf x}_{\perp}) - \phi^{*}_{k_z} ({\bf x}_{\perp}) \Bigl(H_{\perp} (t)+ k_z^2 + m^2 \Bigr) \phi_{k_z} ({\bf x}_{\perp}) \Bigr], \label{B-lag}\end{aligned}$$ where $$\begin{aligned}
H_{\perp} (t) = {\bf p}_{\perp}^2 + 