Is it possible to turn off Internet access when locking the iPhone? I'd like to automatically turn off all access to the Internet (through Wi-Fi &amp; Mobile Data) on my iPhone when locking it. I don't really like to get notifications from different apps when the iPhone is locked.

However, I do want to get all these notifications when I'm around and playing with it—so, basically, when I unlock my iPhone, I want to turn access to the Internet back on again.

Can this be done?  If so, what's the easiest way to do it?
Unfortunately there's no such feature in the current version of iOS (9.3), but there are some tricks you can still do now to achieve almost what you're asking for.

On iOS 9
In this version of the Apple's OS you can keep open the settings app in the background, keeping it open in the Cellular Data section so you can easily open the app and turn Off or On your Cellular Data before you Lock or after you unlock your iPhone.

On iOS 10
Beta coming on July. Official release coming this Fall. You may also think about updating your iPhone to iOS 10 when it comes out this Fall (or even to the Beta which is coming this July, but may not be very stable), in fact on iOS 10, (if you have an iPhone 6s) you can use the 3D Touch on the Settings app to get straight to the Cellular Data's section.
If you have an iPhone 6 or previous and no iPhone 6s, some coders have found out in the iOS 10 code a 6th toggle at the Top of the Control Center, and it's green. This means either it's for Battery settings or for Cellular Data ones (as they're the only green toggles in Settings).
So we may have a Wi-Fi and a Cellular Data toggle at the Top of the Control Center in iOS 10, and this may help you solve your problem as the only thing you'd have to do is simply switching them Off or On via the Control Center without even opening the Settings app.

Even if you do update to iOS 10, or not, you can still solve your problem by keeping open the Cellular Data's section in the Settings App, as that won't cost you that much of battery life.

Other methods
In the end, as some have already pointed out, if you don't mind about Cellular Data turned on, but you care just about not receiving the 'vibration' when a notification appears, but still want to see notifications on your lock screen, this can be done on the Control Center pressing the moon button.
Doing so you just activated the Do not disturb mode. Although you won't receive upcoming calls this way, in Settings you can specify wether to allow calls from your favorites, everybody or nobody, or even if you want to get notified about repeated calls - as Apple specifies:

When enabled, a second call from the same person within three minutes
will not be silenced.

For further informations about this mode, and how you can customize (and even schedule!), you may want to check out Apple's dedicated Support Webpage for it.
Hope this helped you out.