Suppose we have $f\in L^2([0,1])$,and for every $\varphi\in C_{0}^{\infty}((0,1))$, we have $$\int_0^1 f(x)\varphi(x)dx=0$$
Then how can I show $f=0$ a.e? I know when $f\in C^0([0,1])$ the results holds, and $L^2([0,1])$ is the closure of $C^0([0,1])$ with the $L^2$ norm. What I am trying to do is supposing we have a sequence $\{f_n\}\in C^0([0,1])$ converging to $f$ in the $L^2$ norm, then we have
$$\left(\int_0^1 (f_n-f)\varphi dx\right)^2\leq \int_0^1 |f_n-f|^2 dx \int_0^1 |\varphi|^2dx\rightarrow 0$$
So $\displaystyle \int_0^1 f_n\varphi dx\rightarrow 0$. Then I don't know what to do next.
If you know that $C_0^\infty((0,1))$ is dense in $L^2([0,1])$, a natural approach is to do what you did: take a sequence $\phi_n$ in $C_0^\infty((0,1))$ converging to $f$ in $L^2$ and obtain, $$ \int_0^1 |f|^2 = \int_0^1 (f-\phi_n)\overline{f} \le \|f-\phi_n\|_{L^2}\|f\|_{L^2}\to 0 $$ hence $\int_0^1 |f|^2=0$.
Without the density result, I would use a different approach, which also works for other $L^p$ spaces. Suppose that the set $\{x:f(x)\ne 0\}$ has positive measure. Then it contains some Lebesgue point of $f$, say $a$. This implies that the averages $$\frac{1}{2h}\int_{a-h}^{a+h} f(x)\,dx$$ approach some nonzero value $y\ne 0$. Take a symmetric bump function $\phi$ centered at $0$ and supported on $[ -h, h]$. Integration by parts and symmetry yields $$ \int_0^1 f(x)\phi(x-a)\,dx = -\int_0^h \phi'(s)\int_{a-s}^{a+s}f(x)\,dx\,ds $$ which is nonzero for small $h$, since $\phi'$ is negative and the integrals of $f$ all have the same sign.