Your digital camera contains a light-sensitive panel that records the light that hits it when you press the button to take a photo. This performs the same function that film does in older cameras. The sensor remains hidden behind the closed shutter (see below) and is only exposed when a photo is taken. Your camera records the light hitting the sensor when you take a picture, and stores the result on the memory card in the camera.
A cameras shutter sits just in front of the image sensor. It is normally closed so that no light is getting through to the sensor, but when you press the button, it opens for a certain length of time to expose the sensor to light. The shutter in most cameras will be comprised of two curtains. For longer exposures, the whole sensor might be exposed for a period of time before the second curtain closes it. In the case of fast shutter speed however, the first curtain opens only a tiny gap between it and the second curtain, and travels across the sensor with the second curtain following close behind. The speed of the shutter is expressed in whole seconds as well as fractions of a second. A shutter speed of 1/640 means the shutter will open and the sensor exposed for only one-six-hundred-and-fortieth of a second.