The point about the knee is that the lower part of the quads join on to the top part of the tibia. The rectus femoris in particular goes right over the front of the patella so stretching strongly will apply quite a bit of pressure.
If you do have knee problems then you should be careful when doing quad stretches. The lying down version will still use the same functional movement so also apply pressure. If you don’t have knee problems then you should be ok.
As for doing the stretch the important thing to remember is that you are aiming to lengthen the entire quads. People often focus on pulling their heel up to their bum but doing that places more pressure than necessary over the top of the knee.
A slightly better focus for the stretch is to concentrate on standing tall and gently pulling the foot up and back while pushing the hips forward. This helps in particular with the rectus femoris as that starts on the pelvic girdle (rather than the femur which is the origin for the other quad muscles).
Also when doing the quad stretch in this way you will additionally be able to stretch out your iliacus and psoas major – which is always nice 🙂