Suppose there is an injective ring homomorphism $f:\mathbb{Z}_m\rightarrow\mathbb{Z}_n$, let $\overline{k}=f(\overline{1})$. Then it is easy to see that $\forall x\in\mathbb{Z}:(f(\overline{x})=\overline{0}\Leftrightarrow n\mid xk)$ and $\forall x\in\mathbb{Z}:(\overline{x}=\overline{0}\Leftrightarrow m\mid x)$, so $\forall x\in\mathbb{Z}:(n\mid xk\Leftrightarrow m\mid x)$. So, because $n\mid nk$, then $m\mid n$, so let $n=md$. Also, because $m\mid m$, then $n\mid mk$, so $d\mid k$. Moreover, it is easy to see that $\overline{k^2}=\overline{k}$ (apply $f$ to $\overline{1}\cdot\overline{1}=\overline{1}$), so $n\mid (k-1)k$, so $m\mid k-1$. Therefore, because $d\mid k$ and $m\mid k-1$, we conclude that $d$ is relatively prime with $m$.
On the other hand, if $n=md$ and $d$ is relatively prime with $m$, then there are $m',d'\in\mathbb{Z}$ such that $mm'+dd'=1$, so let $k=dd'$, then $d\mid k$ and $m\mid k-1$, so $n\mid k(k-1)$ and $\forall x\in\mathbb{Z}:(n\mid xk\Leftrightarrow m\mid x)$. Then it easy to see that the unique additive function $f:\mathbb{Z}_m\rightarrow\mathbb{Z}_n$ such that $f(\overline{1})=\overline{k}$ is in fact an injective ring homomorphism.
The function you defined is not a homomorphism. For example, $\bar{\phi}(\frac{1}{2}+\frac{1}{3})$ will be $5$ by your definition, which is clearly not $1+1$. (doesn't matter what $K$ is)
Note that $\mathbb{Q}$ is the field of fractions of $\mathbb{Z}$. We have the inclusion $i:\mathbb{Z}\to\mathbb{Q}$, $i(n)=\frac{n}{1}$. So now given an injective ring homomorphism $\phi:\mathbb{Z}\to K$ it is very natural to define:
$\bar{\phi}(\frac{m}{n})=\phi(m)\cdot[\phi(n)]^{-1}$ where $m,n\in\mathbb{Z}, n\ne 0$
Note that since $\phi$ is injective we have $\phi(n)\ne 0$, and so $\phi(n)^{-1}$ is indeed defined. Now let's check that this $\bar{\phi}$ is well defined. Suppose $\frac{m}{n}=\frac{k}{l}$. Then $ml=kn$ and so $\phi(m)\phi(l)=\phi(k)\phi(n)$. Thus:
$\bar{\phi}(\frac{m}{n})=\phi(m)\cdot [\phi(n)]^{-1}=\phi(k)\cdot [\phi(l)]^{-1}=\bar{\phi}(\frac{k}{l})$
So $\bar{\phi}$ is indeed a well defined function. Now similarly you can check that it is indeed a homomorphism and it extends $\phi$. It is also trivially injective, because it is a homomorphism of fields.
We indeed get a universal property of the field of fractions here. Suppose $R$ is an integral domain, $F$ is its field of fractions. Let $i:R\to F$ be the inclusion $i(r)=\frac{r}{1}$. Given an injective homomorphism $\phi:R\to K$ where $K$ is a field, there is a unique homomorphism $\bar{\phi}:F\to K$ such that $\bar{\phi}\circ i=\phi$. This universal property is a special case of the universal property of ring localizations.
Best Answer
A ring homomorphism $f:\mathbb { Z } / n \mathbb { Z }\rightarrow \mathbb { Z }$ induces a homomorphism of additive groups $\mathbb { Z } / n \mathbb { Z }\rightarrow \mathbb { Z }$. A slight generalization of your argument proves that this group homomorphism is the zero homomorphism and so $f$ is the zero map. Whether the zero map qualifies as a ring homomorphism depends on your definitions.