This is a good question, and it does make sense even when $V$ is reducible, and the definitions are equivalent (over an algebraically closed field). Everyone deserves to see this done carefully at least once. It is important. The proof in the wiki link you cite is sloppy, and even if they fixed it, they would use irreducibility (so that open sets are dense), without warning, which is pedagogically immoral as far as I'm concerned. Shafarevich does some similar sleight of hand in his book. It took me a bit to forgive him for that. Getting your hands dirty here should not be avoided.
With that said, I tried to be careful, and I think I have been morally careful, but look out for typos.
If a regular function $\phi$ on $D(f)$ is defined by $g/h$ in a neighborhood $U\subset D(f)$ of $x \in D(f)$, there is always some $u\in \Gamma(V)$ with $x\in D(u)\subset U$ (these $D(\cdot)$ open sets form a basis for the Zariski topology), and then $\phi$ is defined by $(ug)/(uh)$ on $D(uh) \subset D(f)$. So we can always choose an expression for $\phi$ as a rational function at $x$ which is valid in the open set defined by the nonvanishing of its denominator.
So now suppose we have a regular function $\phi$ on $D(f)$ and functions $g_i,h_i \in \Gamma(V)$, $i\in I$ some indexing set, with $\cup_{i\in I} D(h_i) = D(f)$ such that $\phi = g_i/h_i$ on $D(h_i)$.
Let's first show we only need finitely many $i$. (As noted in the comments, you can use Noetherianness here, but I don't.) We have $V(f) = \cap_{i\in I} V(h_i) = V(h_i : i\in I)$. By the Nullstellensatz, $f$ is in the radical of the ideal $(h_i : i\in I)$, i.e., $f^m = v_1h_{i_1} +\dots+ v_nh_{i_n}$ for some $i_1,\dots,i_n\in I$, $v_1,\dots,v_n \in \Gamma(V)$, and $m\in \mathbb{N}$. Lets write $h_j := h_{i_j}$. Now $V(h_1,\dots,h_n) \subset V(f)$, so $D(h_1)\cup\dots\cup D(h_n) = D(f)$, since all $D(h_i) \subset D(f)$.
Okay, now we have a regular function $\phi$ on $D(f)$ and functions $g_i,h_i \in \Gamma(V)$, $1\le i \le n$, with $\cup_{i=1}^n D(h_i) = D(f)$ such that $\phi = g_i/h_i$ on $D(h_i)$. Now for each $i$, we have $D(h_i) \subset D(f)$, so that $V(f) \subset V(h_i)$, and so by the Nullstellensatz, there is some $q_i \in \Gamma(V)$ and $m_i \in \mathbb{N}$ (let's go ahead and assume without loss of generality that $m_i\ge 2$ for later) so that $q_if = h_i^{m_i}$. Notice that for $x\in D(f)$, $q_i(x) = 0$ if and only if $h_i(x) = 0$. Now as we did above (here we really do need the Nullstellensatz), since $V(h_1,\dots,h_n) = V(h_1^{m_1},\dots,h_n^{m_n}) \subset V(f)$, there exist $p_1,\dots,p_n \in \Gamma(V)$ so that $p_1h_1^{m_1} + \dots + p_nh_n^{m_n} = f^{\ell+1}$ for some $\ell \ge 0$. Now substituting, we have
$$p_1q_1 f + \dots + p_nq_n f = f^{\ell+1}$$
so that
$$p_1q_1 + \dots + p_nq_n = f^{\ell}$$
on $D(f)$. (To get an idea for what's going to happen, see my note at the bottom before proceeding.)
Now I claim that
$$\phi = \sum_{j=1}^n \frac{p_jg_jh_j^{m_j-1}}{f^{\ell+1}}$$
on all of $D(f)$.
Let's check it at any point $x\in D(f)$. Without loss of generality (by reordering), we assume $x\in D(h_j)$ for $j=1,\dots,k$ and $x\notin D(h_j)$ for $j=k+1,\dots,n$. So (each step here uses some stuff from above, so be alert)
$$\left(\sum_{j=1}^n \frac{p_jg_jh_j^{m_j-1}}{f^{\ell+1}}\right)(x) = \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)g_j(x)h_j^{m_j-1}(x)}{f(x)} $$
$$= \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)h_j^{m_j-1}(x)}{q_j(x)f(x)} = \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)h_j^{m_j-1}(x)}{h_j^{m_j}(x)}$$
$$= \frac{1}{f^\ell(x)}\sum_{j=1}^k \frac{p_j(x)q_j(x)g_j(x)}{h_j(x)} = \frac{1}{f^\ell(x)}\sum_{j=1}^k p_j(x)q_j(x) \phi(x)$$
$$=\frac{\phi(x)}{f^\ell(x)}\left(\sum_{i=1}^n p_i(x)q_i(x)\right) = \phi(x).$$
And that's the end. If you read the string of equations backward, you can see the motivation for the claimed form of $\phi$.
Note: If you've ever learned any differential topology, this $p_1q_1+\dots+p_nq_n$ thing is basically a partition of unity with respect to the decomposition $D(h_1)\cup\dots\cup D(h_n)$ of $D(f)$, which lets you sum functions which are only defined locally. To be a little more accurate, it's a partition of $f^\ell$, but that's just as good, since we're allowed to divide by $f^\ell$ on $D(f)$.